十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
添加托盘图标控件,并设置好其Icon属性,然后添加如下代码:
乳源ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
Me.Hide()
End Sub
vb.net 有专门的托盘图标控件 在工具箱里直接添加一个就可以了 两行代码即可
NotifyIcon1.Icon = Me.Icon
NotifyIcon1.Visible = True
添加托盘图标控件,并设置好其Icon属性,然后添加如下代码:
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
Me.Hide()
End Sub
这样实现了点关闭,进入托盘,如果点最小化进入托盘:
'窗体最小化时候隐藏窗体,
Private Sub MainForm_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
Me.ShowInTaskbar = False
End If
End Sub