日本国产亚洲-日本国产一区-日本国产一区二区三区-日本韩国欧美一区-日本韩国欧美在线-日本韩国欧美在线观看

當前位置:雨林木風(fēng)下載站 > 技術(shù)開發(fā)教程 > 詳細頁面

對于任務(wù)欄式的托盤圖標及其右鍵菜單的完成!

對于任務(wù)欄式的托盤圖標及其右鍵菜單的完成!

更新時間:2022-05-09 文章作者:未知 信息來源:網(wǎng)絡(luò) 閱讀次數(shù):

實現(xiàn)方法:(用VS.net的可視化實現(xiàn))
新建一個項目(notifyicon)
把右鍵菜單(contextmenu)拖入表單中.加入菜單的子菜單項。比如“顯示”、“隱藏”等菜單項。
雙擊各菜單項為各菜單項加入單擊事件。
比如:(顯示)me.show
 (隱藏)me.hide
把托盤控件拖入表單中。設(shè)置其顯示文字(.text)、圖標文件(icon)
設(shè)置托盤的右鍵菜單(contextmenu)為你剛才創(chuàng)建的菜單。
這樣就很方便的實現(xiàn)以前VB需要好多的Win API才能實現(xiàn)的功能。

附上該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
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon
Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(notifyIcon))
Me.Button1 = New System.Windows.Forms.Button()
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)
Me.ContextMenu1 = New System.Windows.Forms.ContextMenu()
Me.MenuItem1 = New System.Windows.Forms.MenuItem()
Me.MenuItem2 = New System.Windows.Forms.MenuItem()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(128, 48)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(88, 24)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'NotifyIcon1
'
Me.NotifyIcon1.ContextMenu = Me.ContextMenu1
Me.NotifyIcon1.Icon = New System.Drawing.Icon("C:\root.ico")
Me.NotifyIcon1.Text = "NotifyIcon and ContextMenu"
Me.NotifyIcon1.Visible = True
'
'ContextMenu1
'
Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem2})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.Text = "顯示"
'
'MenuItem2
'
Me.MenuItem2.Index = 1
Me.MenuItem2.Text = "隱藏"
'
'notifyIcon
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Name = "notifyIcon"

End Sub

#End Region


Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
Me.Show()
End Sub

Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Me.Hide()
End Sub
End Class

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統(tǒng)下載排行

主站蜘蛛池模板: 久久精品a亚洲国产v高清不卡 | 综合久久2o19 | 精品日韩欧美一区二区三区在线播放 | 欧洲视频一区 | 国产播放啪视频免费视频 | 欧美成人性毛片免费版 | 亚洲国产精品久久 | 成人在线高清 | 久久99亚洲精品久久久久99 | 日韩精品欧美激情亚洲综合 | 毛片高清一区二区三区 | 免费午夜影片在线观看影院 | 久久99热精品免费观看无卡顿 | 夜夜操女人| 9i9精品国产免费久久 | 99香蕉国产线观看免费 | 久久久久久久影视 | 亚洲视频在线观看一区 | 亚洲国产成人久久综合碰碰动漫3d | 日韩视频高清免费看 | 99国产成人精品2021 | 一区二区免费视频观看 | 久久精品免费 | 青榴社区视频在线观看免费 | 在线免费观看亚洲 | 国产麻豆91欧美一区二区 | 97在线免费观看 | 国产免费不卡v片在线观看 国产免费不卡视频 | 亚洲免费看片 | 国产免费人成在线视频视频 | 国产日韩欧美在线一二三四 | 99久久精品国产一区二区三区 | 国产在线视频国产永久视频 | 国产视频在 | 色综合一本到久久亚洲91 | 夜夜爱影院 | 偷拍自拍五月天 | 精品视频手机在线观看免费 | 国内精品久久影院 | 黄网在线观看免费网站台湾swag | 亚洲成年人在线 |