Use VB to create real-time dynamic buttons

Source: Internet
Author: User
First, generate two buttons command1 and command2 with the same size on the main form, set their style attributes to 1-graphical, and set the picture attribute of command1 to D: /Vb/ICO/mail01a. ICO (the pattern before the change, a closed envelope), set the picture attribute of command2 to D:/Vb/ICO/mail101b. ICO (a changed pattern, an opened envelope ).
Second, add the following code to the private sub form-load () of the main form:
Form1.command1. Top = form1.height-7000
Form1.command1. Left = form1.width-1300
Form1.command2. Top = form1.height-7000
Form1.command2. Left = form1.width-1300 'to merge the two buttons and place them in the upper right corner of the form.
Form1.command1. Visible = trueform1.command2. Visible = false
'Hide the command2 button and display the command1 button.
Again, add the following code to the Command1-MouseMove event:
If form1.command1. Visible = true then
Form1.command1. Visible = false
Form1.command2. Visible = true
End if
'If you move the mouse over the button, the envelope opening pattern is displayed.
Finally, add the following code to the form-mousemove event: (if the button is placed on the widget, add the code to the Picture1-MouseMove event)
If form1.command1. Visible = false then
Form1.command2. Visible = false
Form1.command1. Visible = true
End if
'If you move the mouse out of the button, the envelope is closed.
After a few steps above, you have an instant dynamic button on your form, and the click event of this button is a Command2-Click. This program runs on P100, 32 m ram, and the Chinese version of Win95.

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.