日期:2014-05-18  浏览次数:20746 次

如何以最大(小)化方式显示程序窗体
如何以最大(小)化方式显示程序窗体!!!!

------解决方案--------------------
窗体的WindowState属性改成Maximized
------解决方案--------------------
也可以代码实现
C# code
this.WindowState=FormWindowState.Maximized

------解决方案--------------------
C# code

this.WindowState = FormWindowState.Maximized; //最大化
            this.WindowState = FormWindowState.Minimized; //最小化
            this.WindowState = FormWindowState.Normal;//正常

------解决方案--------------------
探讨
C# code
this.WindowState = FormWindowState.Maximized; //最大化
this.WindowState = FormWindowState.Minimized; //最小化
this.WindowState = FormWindowState.Normal;//正常

------解决方案--------------------
private const int SW_HIDE = 0;
private const int SW_SHOWNORMAL = 1;
private const int SW_SHOWMINIMIZED = 2;
private const int SW_SHOWMAXIMIZED = 3;
private const int SW_SHOWNOACTIVATE = 4;
private const int SW_RESTORE = 9;
private const int SW_SHOWDEFAULT = 10; 

[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); 

private void button1_Click(object sender, EventArgs e)
{//最小化显示窗体
ShowWindowAsync(this.Handle, SW_SHOWMINIMIZED);
}
private void button2_Click(object sender, EventArgs e)
{//最大化显示窗体
ShowWindowAsync(this.Handle, SW_SHOWMAXIMIZED);
}
private void button3_Click(object sender, EventArgs e)
{//还原显示窗体
ShowWindowAsync(this.Handle, SW_RESTORE);
}