C#托盘程序
程序引用来自:
http://community.csdn.net/Expert/topic/3265/3265446.xml?temp=9.060305E-02
http://community.csdn.net/Expert/topic/3265/3265446.xml?temp=9.060305E-02
 1 private void ShowHideWindow(bool isShow)
private void ShowHideWindow(bool isShow)
2 {
{
3 if(isShow)
    if(isShow)
4 {
    {
5 if(this.ShowInTaskbar==false)
        if(this.ShowInTaskbar==false)
6 {
        {
7 this.ShowInTaskbar = true;
            this.ShowInTaskbar = true;
8 this.Show();
            this.Show();
9 this.WindowState = FormWindowState.Normal;
            this.WindowState = FormWindowState.Normal;
10 }
        }
11 else
        else
12 {
        {
13 if(this.WindowState == FormWindowState.Minimized)
            if(this.WindowState == FormWindowState.Minimized)
14 {
            {
15 this.WindowState = FormWindowState.Normal;
                this.WindowState = FormWindowState.Normal;
16 }
            }
17 }
        }
18 this.Activate();
        this.Activate();
19 }
    }
20 else
    else
21 {
    {
22 if(this.ShowInTaskbar == true)
        if(this.ShowInTaskbar == true)
23 {
        {
24 this.Hide();
            this.Hide();
25 this.ShowInTaskbar = false;
            this.ShowInTaskbar = false;
26 }
        }
27 }
    }
28 }
}
29
30
 private void ShowHideWindow(bool isShow)
private void ShowHideWindow(bool isShow)2
 {
{3
 if(isShow)
    if(isShow)4
 {
    {5
 if(this.ShowInTaskbar==false)
        if(this.ShowInTaskbar==false)6
 {
        {7
 this.ShowInTaskbar = true;
            this.ShowInTaskbar = true;8
 this.Show();
            this.Show();9
 this.WindowState = FormWindowState.Normal;
            this.WindowState = FormWindowState.Normal;10
 }
        }11
 else
        else12
 {
        {13
 if(this.WindowState == FormWindowState.Minimized)
            if(this.WindowState == FormWindowState.Minimized)14
 {
            {15
 this.WindowState = FormWindowState.Normal;
                this.WindowState = FormWindowState.Normal;16
 }
            }17
 }
        }18
 this.Activate();
        this.Activate();19
 }
    }20
 else
    else21
 {
    {22
 if(this.ShowInTaskbar == true)
        if(this.ShowInTaskbar == true)23
 {
        {24
 this.Hide();
            this.Hide();25
 this.ShowInTaskbar = false;
            this.ShowInTaskbar = false;26
 }
        }27
 }
    }28
 }
}29

30

 
                    
                

 
     
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号