最小到托盘
1 全局代码
Public NotifyIcon As New System.Windows.Forms.NotifyIcon()
'初始化组件.此函数在AfterOpenProject事件中调用
Public Sub InitNotifyIcon()
NotifyIcon.Ballo + vbcrlf + "Win7用户请注意,图标会自动隐藏.需要设置为""显示图标和通知"""
NotifyIcon.Ballo
NotifyIcon.Text = "如果需要,这里还可以显示菜单.比如""停止"",""运行""等按钮"
NotifyIcon.Icon = New Icon("Images\001.ico")
NotifyIcon.Visible = False
AddHandler NotifyIcon.Click, AddressOf NotifyIcon_Click
End Sub
'单击右下角小图标时,恢复窗体
Private Sub NotifyIcon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim frm As System.Windows.Forms.Form = Tables("表A").Grid.TopLevelControl
frm.ShowInTaskBar = True
NotifyIcon.Visible = False
frm.Show()
Forms("窗口1").Show()
End Sub
Public Sub HideForm()
Dim frm As System.Windows.Forms.Form = Tables("表A").Grid.TopLevelControl
frm.ShowInTaskBar = False
frm.Hide()
NotifyIcon.Visible = True
NotifyIcon.ShowBalloonTip(150)
End Sub
2 按钮
HideForm()
e.Form.Close()
3 Afteropenproject事件
InitNotifyIcon()
注意:001.ico 只支持16*16图标