Custom "Buttons" for your form

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
3 posts Page 1 of 1
Contributors
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Custom "Buttons" for your form
CodenStuff
Hello,

As requested here is a quick tutorial on how to add custom buttons to your form for close/minimize etc. You can do this in lots of different ways but the way I do it is like this...

First thing you need to do is get some button images which you can find in hungryhounds kennel, online or make your own. You need 2 images which will be used as follows:

Image 1 - Primary Image
Image 2 - Used for when your mouse hovers over the picturebox

Once youve got your images you need to add them to your projects resources:
sshot-29.png
Then add a picturebox control to your form for each button you want to create, I used 2 for this tutorial.

Set each pictureboxes image to your primary button image:
sshot-30.png
Now its time for the code so in each "Picturebox_MouseEnter" event add this code:
Code: Select all
PictureBox1.Image = My.Resources.Image2
And in each "Picturebox_MouseLeave" event add this code:
Code: Select all
PictureBox1.Image = My.Resources.Image1
Inside each "Picturebox_Click" event add the code you want to execute such as closing the form or minimize the form.

Dont forget to change "My.Resources.Image1 and My.Resources.Image2" to the name of your images in resources.

Thats it your finished cooll;
You do not have the required permissions to view the files attached to this post.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Toby64800
New Member
New Member
Posts: 14
Joined: Sat Dec 05, 2009 7:37 pm

how to get a picture into the recorses
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Hello,

Using the top menu bar click "Project" > "Your project properties" > then click the "Resources" tab then "Add resource" button.

Thank you.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
3 posts Page 1 of 1
Return to “Tutorials”