vb.net@H_301_5@
Private Sub vbFormTest_Resize(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Resize
If WindowState = FormWindowState.Minimized Then
Me.Visible = False
Me.NotifyIcon1.Visible = True
End If
End Sub@H_301_5@
Private Sub NotifyIcon1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles NotifyIcon1.Click
Me.Visible = True
NotifyIcon1.Visible = False@H_301_5@
Me.WindowState = FormWindowState.Normal
End Sub@H_301_5@
c#.net@H_301_5@
//调整窗体大小的时候,如果是最小化,窗体不显示,在托盘中显示@H_301_5@
private void Form1_Resize(object sender,EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = false;
this.notifyIcon1.Visible = true;
}
}@H_301_5@
//如果点击托盘中的窗体图标,则窗体显示,托盘中的图标隐藏@H_301_5@
private void notifyIcon1_Click(object sender,EventArgs e)
{
this.Visible = true;
this.notifyIcon1.Visible = false;@H_301_5@
WindowState = FormWindowState.Normal; }@H_301_5@ 原文链接:https://www.f2er.com/vb/260156.html