VB easy to create gorgeous button

Source: Internet
Author: User
Tags border color

Introduction: A Very cool skin control, you can change the style of CommandButton in your form to XP, Java and so on. Recommended downloads.

Using the sample
Want to make your program more eye-catching? Want to create a Windows XP, Java, flat-style button in your program? As long as you add BSE control in your program, a simple line of code, you can easily achieve up to 16 kinds of style buttons, completely let you abandon the complicated code! Here we will combine an example to illustrate the use of the method, and show the powerful features of the control implementation!
BSE control one can achieve 15 different styles, by setting the control's Schemestyle property, we can easily control the style of CommandButton in the window interface. Schemestyle's property settings correspond to their implementation style as shown in table one:

Schemestyle Property Effect Style and description
0 Windows XP Blue Scheme Button Style
1 Windows XP Olive Green Scheme Button Style
2 Windows XP Silver Scheme Button Style
3 Windows Flat Scheme Button Style
4 Windows Hover Scheme Button Style
5 Netscape Scheme Button Style
6 Java Scheme Button Style
7 Windows Old 3.x Scheme Button Style
8 Office XP Blue Scheme Button Style
9 Office XP olivegreen Scheme Button Style
10 Office XP Silver Scheme Button Style
11 Office XP systemcolor Scheme Button Style
12 Windows XP InternetExplorer Scheme Button Style
13 Gradient Scheme Button Style
(gradient color background style)
14 Alien Scheme Button Style
(with a metal-textured button)
15 Bitmap pattern Scheme Button Style
(Implements the background of the button, independent of the picture of the button itself)

Once we know the style of the button, we can set the style according to our own preferences.
Step one: Start Visual Basic 6.0 first and create a new window.
  
Step two: Load the BSE control and set its properties.
① Right-click in the Control toolbar, select "Part", click "Browse" in the pop-up window, locate the BSE control, load it, and add it to any location in the Form1 form.
② modify BSE control properties. Right-click on the BSE control and select Properties. In the Pop-up Property Page Setup window, select options, as shown in Figure 1, where you want to set the properties on your own.


Where the picture setting "pattern Bitmap Images" is only valid when the Schemestyle value is set to 15 o'clock, it is the background picture of the button display. The gradient Scheme Options can set the direction and start and end colors of the background gradient only if the Schemestyle value is set to 13 o'clock. The Border highlight Effect Options can set the border color of some style button clicks.
Step three: Load other controls to complete the setup of the interface.
① adds 4 CommandButton controls to the form, named Command1, Command2, Command3, Command4, where the style property for the latter two buttons is "1-gradical" and then sets their picture , add two appropriate pictures for them (Figure 2). The other settings for the button refer to Figure 2.
② adds an option control array with the name "Option1" and the index from 0 to 15. The caption setting is shown in Figure 2.
Here we have completed the interface settings of this demo program, and then write the code.


The fourth step: Write the code, realize the concrete function.
① writes the FORM1 load event so that when the program starts, CommandButton displays the style that you said it was set for you, using the first style, the Windows XP blue style. The code is as follows:
Private Sub Form_Load ()
BSE1. Schemestyle = 0
BSE1. Endsubclassing
BSE1. Initsubclassing
End Sub

② the event to add an option control array so that different styles of CommandButton can be converted based on the option option.
Private Sub Option1_click (Index as Integer)
BSE1. Schemestyle = Index
BSE1. Endsubclassing
BSE1. Initsubclassing
End Sub

③ write the code to exit the program, and then add the following code to the Command4 click event:
If BSE1. Enginestarted Then
BSE1. Endsubclassing ' Unload BSE control
End If
Unload Me

Here, this simple demo program is complete, is not very simple? Just a few lines of code can implement such a cool button. Just press F5 and see how it works (Figure 3).


You can click on different OptionButton, watch 16 different button styles, I believe there is always a program that will suit you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.