★ VB.NET Custom Buttons | 2 ways ★
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.
8 posts
Page 1 of 1
Hello Coders, In this tutorial i will show you how to make a custom button in Visual Basic 2008 / 2010
The First Way
≫Open VB and start new windows form application
≫Create New UserControl name it anything you want and then Change these properties :
Size : To what you want
MinimumSize : The Same as the Size exactly
MaximumSize : The Same as the Size exactly
BorderStyle : Fixed Single
≫And add a button and set it properties to :
Name to : Btn
Text : To the custom button name or anything you want
BorderStyle : Flat
Change Modifiers to : Friends
≫And now change the button theme you can change the colors of : Back + Fore or Add A background image..
when you done Debug it and see in your ToolBox you will found the button at the top add it to your form and then you can add codes like this Example :
The Second way
Its too easy just
≫Add a button and change it background image to what you want then add 3 images to your resources
1 Button up
1 Button down
1 Button Hover
≫On Button1_MouseUp
Hope you learn something from this simple tutorial please don't forget
Comment, Rate, +Rep if you like it!
The First Way
≫Open VB and start new windows form application
≫Create New UserControl name it anything you want and then Change these properties :
Size : To what you want
MinimumSize : The Same as the Size exactly
MaximumSize : The Same as the Size exactly
BorderStyle : Fixed Single
≫And add a button and set it properties to :
Name to : Btn
Text : To the custom button name or anything you want
BorderStyle : Flat
Change Modifiers to : Friends
≫And now change the button theme you can change the colors of : Back + Fore or Add A background image..
when you done Debug it and see in your ToolBox you will found the button at the top add it to your form and then you can add codes like this Example :
Code: Select all
Finish !<CUSTOMBUTTON>.btn.text = "Button1"
Custombutton.btn.forecolor = color.black
The Second way
Its too easy just
≫Add a button and change it background image to what you want then add 3 images to your resources
1 Button up
1 Button down
1 Button Hover
≫On Button1_MouseUp
Code: Select all
≫On Button1_MouseDown
Button1.BackgroundImage = My.Resources.<MouseUpImage>
Code: Select all
≫On Button1_MouseHover
Button1.BackgroundImage = My.Resources.<MouseDownImage>
Code: Select all
Finish !Button1.BackgroundImage = My.Resources.<MouseHoverImage>
Hope you learn something from this simple tutorial please don't forget
Comment, Rate, +Rep if you like it!
Last edited by CleverBoy on Tue Mar 08, 2011 9:48 pm, edited 1 time in total.
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
For n00bs, this is a great tutorial, for me, i already know this. but you will get +rep for making a tutorial
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
CodexVideos wrote:For n00bs, this is a great tutorial, for me, i already know this. but you will get +rep for making a tutorialI was just free so i think to make a tutorial + my pc is crashed and im using mac for this resone no screans + lol did you notice that the title like ? Nery tutorial lol ! 8-)
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
for the code
Code: Select all
How exactly do you input it and where. What is CUSTOMBUTTON changed to? if it changed? if these questions could be answered, it would be of great help<CUSTOMBUTTON>.btn.text = "Button1"
Custombutton.btn.forecolor = color.black
OK then you need private tutorial :P
This is the First Way
Look CUSTOMBUTTON isn't right you should rename it with the Button name you choosed for this.
So lets start from beginning:
First: Create new VB Project or Use the one u working on it
Second: Create new UserControl and name it zButton (Just example)
Third: Change the UserControl (zButton) properties so:
the Size should be like what u want
then Copy the 'size' and paste it in "Maximum Size" and "Minimum Size"
then change BorderStyle to Fixed Single or Any1 u want
ok
Now!
Add a button to the UserControl
Name it "Btn"
and change Dock to "Fill"
and text to "zButton" or anything u want
and FlatStyle to Flat
IMPORTANT!!! to :change modifiers to "Friends"
then now you can change the Button Colors or Add Image to it or anything u want to do to change the button to make it custom
when u finish debug your program and stop debuging then you will see in ur Toolbox the Usercontrol add it to ur form
then... you can't edit the button but u can by codes like:
----
xD this is my explanation if u understand cooll; if not not my problem dunnno; :P
... but i tthink the second way is better lmao;
:roll: :!: puko; im tired from typing ...
Thanks
+rep +donate if you want +rate 5 :P
This is the First Way
Look CUSTOMBUTTON isn't right you should rename it with the Button name you choosed for this.
So lets start from beginning:
First: Create new VB Project or Use the one u working on it
Second: Create new UserControl and name it zButton (Just example)
Third: Change the UserControl (zButton) properties so:
the Size should be like what u want
then Copy the 'size' and paste it in "Maximum Size" and "Minimum Size"
then change BorderStyle to Fixed Single or Any1 u want
ok
Now!
Add a button to the UserControl
Name it "Btn"
and change Dock to "Fill"
and text to "zButton" or anything u want
and FlatStyle to Flat
IMPORTANT!!! to :change modifiers to "Friends"
then now you can change the Button Colors or Add Image to it or anything u want to do to change the button to make it custom
when u finish debug your program and stop debuging then you will see in ur Toolbox the Usercontrol add it to ur form
then... you can't edit the button but u can by codes like:
Code: Select all
important to do zButton1.BTN!!!... anythingzButton1.btn.text = "CodenStuff" 'or anything :D
----
xD this is my explanation if u understand cooll; if not not my problem dunnno; :P
... but i tthink the second way is better lmao;
:roll: :!: puko; im tired from typing ...
Thanks
+rep +donate if you want +rate 5 :P
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
+rep to you. For the customizing i get it now, but instead of colour.black would it possible to use HTML colours ( ARGB value )
or any charts that acually show what the colour looks like? for example : firebrick
NVM i see the chart or list at the properties lol im so forgetful at time omg; well thanks for your tut cooll; cooll; cooll; wahooo;
or any charts that acually show what the colour looks like? for example : firebrick
NVM i see the chart or list at the properties lol im so forgetful at time omg; well thanks for your tut cooll; cooll; cooll; wahooo;
There are 3 ways, one is inheriting UserControl and simply adding button on it, second one is inheriting Button it self and messing with it's events, and third one is inheriting Control and making it from scratch !
Thanks mate i had fun helping newbie :P
Code'N'Stuff
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
OneTeam..OneDream
Join ABSplash Team & Earn $$
ABSplash Site - Workpad - (VB) Custom Buttons 2 ways
8 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023