添加托盤(pán)圖標(biāo)控件,并設(shè)置好其Icon屬性,然后添加如下代碼:
乳源ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書(shū)未來(lái)市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)公司的ssl證書(shū)銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18980820575(備注:SSL證書(shū)合作)期待與您的合作!
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 有專門(mén)的托盤(pán)圖標(biāo)控件 在工具箱里直接添加一個(gè)就可以了 兩行代碼即可
NotifyIcon1.Icon?=?Me.Icon
NotifyIcon1.Visible?=?True
添加托盤(pán)圖標(biāo)控件,并設(shè)置好其Icon屬性,然后添加如下代碼:
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
Me.Hide()
End Sub
這樣實(shí)現(xiàn)了點(diǎn)關(guān)閉,進(jìn)入托盤(pán),如果點(diǎn)最小化進(jìn)入托盤(pán):
'窗體最小化時(shí)候隱藏窗體,
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