同意楼上所说,用NotifyIcon组件: private void notifyIcon1_DoubleClick(object Sender, EventArgs e) { // Show the form when the user double clicks on the notify icon. // Set the WindowState to normal if the form is minimized. if (this.WindowState == FormWindowState.Minimized) this.WindowState = FormWindowState.Normal; // Activate the form. this.Activate(); }
就这样就可以了!
我有想过这,最小化的事件是什么呢?还是最好是code取消最小化,不然这种效果对程序的意义不是很大。
notifyIcon_M.Icon = this.Icon;
notifyIcon_M.Text = "xxx";
notifyIcon_M.Visible = true;
弄个托盘 然后自己写最大最小事件
{
// Show the form when the user double clicks on the notify icon. // Set the WindowState to normal if the form is minimized.
if (this.WindowState == FormWindowState.Minimized)
this.WindowState = FormWindowState.Normal; // Activate the form.
this.Activate();
}
msdn上有一个例子。