最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
关于任务栏式的托盘图标及其右键菜单的实现!
时间:2022-07-02 11:40:47 编辑:袖梨 来源:一聚教程网
实现方法:(用VS.net的可视化实现)
新建一个项目(notifyicon)
把右键菜单(contextmenu)拖入表单中.加入菜单的子菜单项。比如“显示”、“隐藏”等菜单项。
双击各菜单项为各菜单项加入单击事件。
比如:(显示)me.show
(隐藏)me.hide
把托盘控件拖入表单中。设置其显示文字(.text)、图标文件(icon)
设置托盘的右键菜单(contextmenu)为你刚才创建的菜单。
这样就很方便的实现以前VB需要好多的Win API才能实现的功能。
附上该form的源代码
Public Class notifyIcon
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
新建一个项目(notifyicon)
把右键菜单(contextmenu)拖入表单中.加入菜单的子菜单项。比如“显示”、“隐藏”等菜单项。
双击各菜单项为各菜单项加入单击事件。
比如:(显示)me.show
(隐藏)me.hide
把托盘控件拖入表单中。设置其显示文字(.text)、图标文件(icon)
设置托盘的右键菜单(contextmenu)为你刚才创建的菜单。
这样就很方便的实现以前VB需要好多的Win API才能实现的功能。
附上该form的源代码
Public Class notifyIcon
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
相关文章
- 明日之后步枪兵技能怎么点攻略 06-15
- 奇迹暖暖花语藤蔓午夜玫瑰获得方式有哪些 06-15
- 深空之眼Roguelike模式多维变量怎么样 06-15
- SQD币怎么操作?2025OKX交易所新手投资 06-15
- HOME币购买步骤-2025币安交易所快速教程 06-15
- 奇迹暖暖第三卷第三章支线1怎么怎么搭配最强 06-15