C# :Winform窗体最大化与最小化

窗口最小化

// minimized 表示窗口最小化
  this.WindowState = FormWindowState.Minimized;

窗口最大化与默认大小

//定义一个布尔变量用来切换最大化和默认值    
bool b = true;
private void button2_Click(object sender, EventArgs e)
{

    if (b)
    {
        //最大化
        this.WindowState = FormWindowState.Maximized;
        b = false;
    }
    else
    {
        //默认值
        this.WindowState = FormWindowState.Normal;
        b = true;
    }
}

转载于:https://www.cnblogs.com/xianchengzhang/p/12545738.html

猜你喜欢

转载自blog.csdn.net/weixin_44690047/article/details/112685983