Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write pallet program with VB.NET

2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to use VB.NET to write pallet procedures, the article is very detailed, has a certain reference value, interested friends must read it!

The design and running environment of this program

(1) Windows 2000 Service

(2) Net Framework SDK official version

The programming process of VB.NET static pallet program

The so-called VB.NET static tray program refers to the tray program in which the icon in the system tray area is at rest after the program runs. On the contrary, the dynamic tray program refers to a kind of tray program that animates the icon in the system tray area. Let's take a look at how VB.NET implements the static tray program.

.net FrameWork SDK provides a component for writing pallet programs: the NotifyIcon component. The NotifyIcon component is a WinForm component located in the namespace "System.Windows.Forms". In the VB.NET program, just create an instance of the NotifyIcon component and assign a value to the "Icon" property of the NotifyIcon instance, and such a simple pallet program is completed. Here is the code (Form1.vb) for this simple pallet program:

Public Class Form1

Inherits System.Windows.Forms.Form

# Region Code generated by the Windows forms designer

Public Sub New ()

MyBase.New ()

'This call is required by the Windows forms designer.

InitializeComponent ()

'add any initialization after the InitializeComponent () call

End Sub

'form rewrite disposal to clean up the list of components.

Protected Overloads Overrides Sub Dispose

(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

Components.Dispose ()

End If

End If

MyBase.Dispose (disposing)

End Sub

'required for the Windows forms designer

Private components As System.ComponentModel.IContainer

'Note: the following procedures are required for the Windows forms designer

'you can modify this process using the Windows forms designer.

'don 't use the code editor to modify it.

Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon

'create an instance of NotifyIcon

Friend TrayIcon = New Icon ("Tray.ico")

'create an instance of Icon

Private Sub InitializeComponent ()

Me.components = New System.ComponentModel.Container ()

Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon

(Me.components)

Me.NotifyIcon1.Text = "NotifyIcon1"

Me.NotifyIcon1.Visible = True

'assign a value to the Icon attribute of the NotifyIcon instance to complete the simple pallet program

Me.NotifyIcon1.Icon = TrayIcon

Me.AutoScaleBaseSize = New System.Drawing.Size (6,14)

Me.ClientSize = New System.Drawing.Size (292,273)

Me.Name = "Form1"

Me.Text = "Form1"

End Sub

# End Region

End Class

'start the program

Module Module1

Sub Main ()

Application.Run (new Form1 ())

End sub

End Module

The above is all the contents of the article "how to write pallet programs in VB.NET". Thank you for reading! Hope to share the content to help you, more related 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report