winform最小化後隱藏到右下角,單擊或雙擊後恢復
阿新 • • 發佈:2019-01-07
notifyIcon控制元件。下面的程式碼
private void MainForm_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
}
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (this.ShowInTaskbar == false)
notifyIcon1.Visible = true;
this.ShowInTaskbar = true;
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}