In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use the VB.NET NotifyIcon control, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
The programming environment used in this paper is Microsoft Visual Studio 2005. First, open Visual Studio. On the File (File) menu, click New Project (New Project). In the template (Templates) pane of the New Project (New Project) dialog box, click Windows Application (Windows Application). Click OK (OK).
To minimize the form icon to be automatically hidden to the taskbar, we can use a control called the VB.NET NotifyIcon control, open the toolbox on the left, find the VB.NET NotifyIcon control and drag it directly onto the form. Set the Icon property of NotifyIcon, and of course you can set a good-looking icon for the ICON property.
Click on the Form1 form, enter the property settings, and set the WindowState of the Form to the Minimized;ShowInTaskbar property to False.
Next we're going to enter the code:
Private Sub Form1_Resize (ByVal sender As Object
ByVal e As System.EventArgs) Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide ()
End If
End Sub
In the Resize code event of Form, the code means that the form is automatically hidden to the status bar when it is minimized. In this way, the form will be automatically hidden at run time and appear in the status bar. If you want to double-click the icon to display the form, you can set the DoubleClick code of the VB.NET NotifyIcon control:
Private Sub NotifyIcon1_DoubleClick (ByVal sender As Object
ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
Me.ShowInTaskbar = True
Me.Show ()
Me.WindowState = FormWindowState.Normal
End Sub
If we want to create a right-click menu, we can add a ContextMenustrip control to the form and associate it with the ContextMenu property of NotifyIcon. Select the menu and toolbar in the toolbox, drag the ContextMenu control directly onto the form to enter the property settings, and enter the corresponding menu keywords. Then click the VB.NET NotifyIcon control of the form, set the properties, and select the right-click menu ContextMenustrip you just edited at contextmenustrip to associate it. Then press F5 to run the program, click the form minimize button, the icon of the form is automatically hidden to the status bar. Click on the right button and you can see the beautiful right-click menu.
The above is all the content of this article "how to use VB.NET NotifyIcon controls". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.