In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about the concept of VB.NET Button control, many people may not know much about it. In order to make you understand better, the editor summarizes the following content for you. I hope you can get something according to this article.
There are many controls in the VB.NET programming language for our convenience. The use of these controls is very necessary for programmers. VB.NET Button controls generally accept that mouse click events are used to start, interrupt, or end a process (equivalent to previous versions of Visual Basic CommandButton controls).
The procedure in the procedure that has been written to the Click event is called when the Button control is clicked. The Button control is used in most Visual Basic applications, and the user can click a button to perform the action. When clicked, the button not only performs the appropriate action, but also looks the same as being pressed and released.
1. Add buttons to the form
Multiple buttons are likely to be used in the application. Just like drawing buttons on other container controls, drag the VB.NET Button control directly onto the form from the toolbox. You can resize the button with the mouse or by setting the Location (coordinates that determine the position of the control relative to the top left vertex of the form) and Size (size, * * parameter represents width, and the second parameter represents height).
two。 Set button to display text
You can use the Text property to change the text displayed on the button. At design time, you can set this property in the property window of the control. The button text is dynamically updated after the Text property is set at design time. The Text property contains a maximum of 255characters. If the title exceeds the width of the command button, it will fold to the next line. However, if the control cannot accommodate its full length, the title is cut. You can change the font displayed on the command button by setting the Font property.
3. Create a keyboard shortcut
You can create an access key shortcut to a button through the Text property. To do this, simply add a hyphen (&) before the letter that serves as the access key. For example, to create an access key for the title "Ok", add a hyphen before the letter "O" and get "& Ok". At run time, the letter "O" is underlined and the action performed by the click button program can be performed by pressing the Alt+ O key.
Note: if you do not create an access key but want to include a hyphen in the title, add two hyphens (& &). In this way, only one hyphen is displayed in the title.
4. Selected button
At run time, buttons can be selected using the mouse or keyboard in the following ways:
(1) Click the button with the mouse
(2) press the Tab key to shift the focus to the button, and then press Enter to select the button
(3) Press the access key of the button ([Alt+ with underlined letters]).
5.Click event
Clicking the button at run time triggers the button's Click event and executes the code written to the Click event, while the button click also generates events such as MouseMove, MouseLeave, MouseDown, and MouseUp. If you want to attach event procedures to these related events, you should ensure that actions do not conflict. Depending on the operation on the control, these event procedures occur in a different order. The order in which click events occur for the VB.NET Button control is:
MouseMove → MouseDown → Click → MouseUp → MouseLeave
Note: if a user attempts to double-click a button control, each click will be handled separately; that is, the button control does not support double-click events.
6. Enhance the visual effect of the button
Button controls, like check boxes and option buttons, can use the Image property to set the icon on the VB.NET Button control to enhance the visual effect, and then set the property of the icon (picture): ImageAlign displays the location of the icon (picture). By setting ImageIndex (the index of the picture in the picture box) and ImageList (picture frame), you can achieve the following effects, such as adding icons or bitmaps to the button, or displaying different images when you click or disable the control, and so on.
After reading the above, do you have any further understanding of the concept of VB.NET Button controls? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.