最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
关于任务栏式的托盘图标及其右键菜单的实现!
时间:2008-01-12 编辑:简简单单 来源:一聚教程网
实现方法:(用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
-
上一个: 一个画任意形状的窗体的例子
相关文章
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24
- C语言中atoi函数模拟实现介绍 10-18
- .Net反向代理组件Yarp用法介绍 10-10
- .NET使用YARP通过编码方式配置域名转发实现反向代理教程 10-10