vb.net系统托盘菜单怎样显示在系统托盘图标的上方
PublicClassForm1PrivateSubButton1_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.E...
Public Class Form1
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
ShowInTaskbar = False
NotifyIcon1.Icon = Me.Icon
NotifyIcon1.Visible = True
End Sub
Private Sub 显示窗体ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 显示窗体ToolStripMenuItem.Click
'恢复显示窗体
Me.Show()
End Sub
Private Sub 退出ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出ToolStripMenuItem.Click
'关闭窗体,退出程序
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
ContextMenuStrip1.Visible = True
End Sub
End Class 展开
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
ShowInTaskbar = False
NotifyIcon1.Icon = Me.Icon
NotifyIcon1.Visible = True
End Sub
Private Sub 显示窗体ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 显示窗体ToolStripMenuItem.Click
'恢复显示窗体
Me.Show()
End Sub
Private Sub 退出ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出ToolStripMenuItem.Click
'关闭窗体,退出程序
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
ContextMenuStrip1.Visible = True
End Sub
End Class 展开
展开全部
NotifyIcon1属性中ContextMenustrip=ContextMenuStrip1
在NotifyIcon1的属性中修改就可以了,好像可以去掉以下内容,用鼠标右键点击图标就可以了
Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
ContextMenuStrip1.Visible = True
End Sub
在NotifyIcon1的属性中修改就可以了,好像可以去掉以下内容,用鼠标右键点击图标就可以了
Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
ContextMenuStrip1.Visible = True
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询