Custom Buttons

otherside

Well-known member
Joined
Mar 16, 2003
Messages
127
Location
UK - Greece
Hello again.
Anyone knows how to create a custom button?
What i mean is to make a button from graphics (3 graphics normal state hover state click state)

anyone knows any good toturial i make custom controls ? or any book ?

thanks
 
You want to build your own button from the ground up or just want to inherit from the Button class? For hovering you could use the MouseMove event of the Button class, this means that whatever you put in the code will happen when the mouse is over the control. For click state you could use the MouseDown event to do something to your button and then MouseUp event to get it back to normal.
 
whats better ?
the thing is i want to use the properties of a normal button so inherited of the button class will do it better, i think
but lets say i create it from sratch, i need to use it in many forms withing the same project, how can i add it to the toolbox ?

thanks again
 
If you want the properties and methods of the Button class then inherit from it, creating one from scratch is not worth doing it as you already have one built into .NET framework :).
To add controls to the toolbox you first have to compile it into a DLL, then go into your toolbox, right click and click Add/Remove Items. Then in the .NET components tab select Browse button. You can then select your DLL that contains the control.
 
i need to change its look , ive created images for normal hover down, and what i need is to make a button working with these images, and use it in several forms as a ready component. for example when i need it in a form, to just add it from the toolbox as a another button component.
 
Have a look at this class I just made.
As you will see I didnt use the MouseHover event as I dont quite like how it works.
Create a new Windows Control project include this file and compile it into a DLL, then you can use it from the toolbox.
 

Attachments

Last edited by a moderator:
Back
Top