任何人都可以建议vb.net/c#代码的良好代码示例来在最小化时将其放入系统托盘。
最佳答案
将NotifyIcon控件添加到您的窗体,然后使用以下代码:
private void frm_main_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.ShowInTaskbar = false;
this.Hide();
notifyIcon1.Visible = true;
}
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
notifyIcon1.Visible = false;
}
您可能不需要设置ShowInTaskbar属性。
关于.net - 最小化时如何将.net应用程序放在系统托盘中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76079/