otherside Posted July 11, 2003 Posted July 11, 2003 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 Quote
*Experts* mutant Posted July 11, 2003 *Experts* Posted July 11, 2003 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. Quote
otherside Posted July 11, 2003 Author Posted July 11, 2003 what's 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 let's 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 Quote
*Experts* mutant Posted July 11, 2003 *Experts* Posted July 11, 2003 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. Quote
otherside Posted July 11, 2003 Author Posted July 11, 2003 can you post a very simple example how to do it with inheritance ? thanks Quote
*Experts* mutant Posted July 12, 2003 *Experts* Posted July 12, 2003 What do you want to do in that button? Quote
otherside Posted July 12, 2003 Author Posted July 12, 2003 i need to change it's look , i've 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. Quote
*Experts* mutant Posted July 12, 2003 *Experts* Posted July 12, 2003 So you want different images to be on the background when the mouse is hovering or button is pressed? Quote
*Experts* mutant Posted July 12, 2003 *Experts* Posted July 12, 2003 (edited) 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.newbutton.vb Edited July 12, 2003 by mutant Quote
otherside Posted July 12, 2003 Author Posted July 12, 2003 mutant, thanks very very much, it's great you just ansered a bunch of questions i had. thanks a lot. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.