C # Winform form of traditional upper-right corner button function - minimize, maximize, normalization, closed

In the Form:

Minimize:

this.WindowState = FormWindowState.Minimized; //最小化

maximize:

this.WindowState = FormWindowState.Maximized;

normalization:

this.WindowState = FormWindowState.Normal;

Close (form):

this.Close();

Normalization of a button, switch to maximize each other:

Private  void the button2_Click ( Object SENDER, EventArgs E) 
        { 
            IF ( the this .WindowState == FormWindowState.Maximized) // If maximizing 
            {
                 the this .WindowState = FormWindowState.Normal; // the normalization 
            }
             the else  IF ( the this .WindowState == FormWindowState.Normal) // if normalization 
            {
                 the this .WindowState = FormWindowState.Maximized; // is maximized 
            } 
        }

 

Guess you like

Origin www.cnblogs.com/PER10/p/11541213.html