最新下载
热门教程
- 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
相关文章
- 碧蓝航线的里雅斯特期待的便当时间皮肤有什么 04-30
- 明日之后踏浪逐星服装展示攻略 04-30
- 深空之眼幽月塞勒涅刻印搭配核心思路 04-30
- 明日之后红杉茶会护卫队首领BOSS有哪些 04-30
- CF手游段位奖励汇总攻略 04-30
- 无期迷途5-13怎么走攻略 04-30