this.Show();
if(this.WindowState == System.Windows.Forms.FormWindowState.Minimized)
{
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
this.Activate();
this.ShowInTaskbar = true;
}
为什么我用托盘的时候,用以上代码恢复主窗体,主窗体会变成很小。 
并且一旦主窗体成这种状态就不能修改大小,也不能拖动

解决方案 »

  1.   

    private void Form1_Resize(object sender, System.EventArgs e)
    { if (this.WindowState == FormWindowState.Minimized) 
    {
    this.Visible=false;
    this.notifyIcon1.Visible = true;
    }
    else
    {
    this.notifyIcon1.Visible = false;
    this.Visible = true;
    }
    }
    private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
    {
    if(this.Visible == false) 
    {
    this.Visible = true;
    this.WindowState = FormWindowState.Normal;
    }
    else
    {
    this.WindowState = FormWindowState.Minimized;
    this.Visible = false;
    } }