• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當前位置:雨林木風下載站 > 技術開發教程 > 詳細頁面

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

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

        更新時間:2022-05-09 文章作者:未知 信息來源:網絡 閱讀次數:

        實現方法:(用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
        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

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

        本類教程下載

        系統下載排行

        主站蜘蛛池模板: 久久www免费人成看片| 成人午夜大片免费7777| 国产亚洲精品拍拍拍拍拍| 亚洲国产成人久久笫一页| 亚洲avav天堂av在线网毛片| 好男人视频社区精品免费| 亚洲精品成a人在线观看| 免费无码专区毛片高潮喷水| heyzo亚洲精品日韩| 亚洲美女中文字幕| 91人成网站色www免费下载| 久久丫精品国产亚洲av不卡 | 亚洲黄色在线网站| 114级毛片免费观看| 亚洲成AV人片久久| 香蕉免费看一区二区三区| 免费无码A片一区二三区| 亚洲综合欧美色五月俺也去| 特级淫片国产免费高清视频| 911精品国产亚洲日本美国韩国| 国产福利视精品永久免费| 亚洲精品久久久久无码AV片软件| 美女视频黄a视频全免费网站色窝| 日韩免费视频一区| 三年片在线观看免费观看大全中国| 免费人成在线观看69式小视频| 久久精品国产亚洲AV蜜臀色欲| 国产精品久免费的黄网站| 大妹子影视剧在线观看全集免费 | 亚洲精品岛国片在线观看| 97超高清在线观看免费视频| 亚洲色图黄色小说| 免费无码又爽又刺激高潮 | 亚洲国产精品无码久久98 | a级毛片免费观看视频| 亚洲成人黄色在线观看| 在线免费观看国产视频| 另类免费视频一区二区在线观看| 亚洲人成网国产最新在线| 久久久无码精品亚洲日韩软件| 天天影院成人免费观看|