Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted
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.
Posted

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

  • *Experts*
Posted

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.

Posted
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.
  • *Experts*
Posted (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 by mutant

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...