2
'This is the event that is fired as the application is closing, whether it
'be from a close button in the application or from the user
'clicking the X in the upper right hand corner
Private Sub Form1_FormClosing(sender as Object, e as FormClosingEventArgs) Handles Form1.FormClosing
'What we will do here is trap the closing of the application and send the application
'to the system tray (or so it will appear, we will just make it invisible, re-showing
'it will be up to you and your notify icon)
'First minimize the form
Me.WindowState = FormWindowState.Minimized
'Now make it invisible (make it look like it went into the system tray)
Me.Visible = False
End Sub
Hello again Stackoverflow!Winforms:關閉程序到系統托盤
我試圖做一個應用程序,當你按下X時,該程序將被放入系統托盤。但我不知道我該如何做到這一點,所以搜索谷歌,發現這個代碼。只有VB2010(我使用)不喜歡第四行。任何人都可以給我一個關於這個的快速教程,並使其在VB 2010中工作?
順便說一下,我將很有可能只使用VB今晚,只是爲了使一個應用程序。所以我不想考慮整個語言。
這不是關於Visual Studio,這是關於Winforms的。 Visual Studio也可以製作非窗口應用程序。請編輯您的問題和標籤。 –
我道歉,即時通訊新的。 – Thew
不需要道歉:)我只是想指出Visual Studio和用來製作程序的API之間的區別。 –