winfrom-窗体打开大小和全屏设置
2017-02-06 13:13
197 查看
窗体打开满屏(非最大化),点击按钮全屏,ESC键按下时推出全屏:
public Form1()
{
InitializeComponent();
KeyPreview = true;
DoubleBuffered = true;
StartPosition = FormStartPosition.Manual; //窗体的位置由 Forms.Control.Location 属性确定。
Rectangle rect = Screen.GetWorkingArea(this);
this.Width = rect.Width;
this.Height = rect.Height;
}
private void fullscreen_Click(object sender, EventArgs e)
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Escape:
returnback();
break;
default:
break;
}
}
private void returnback()
{
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
}
public Form1()
{
InitializeComponent();
KeyPreview = true;
DoubleBuffered = true;
StartPosition = FormStartPosition.Manual; //窗体的位置由 Forms.Control.Location 属性确定。
Rectangle rect = Screen.GetWorkingArea(this);
this.Width = rect.Width;
this.Height = rect.Height;
}
private void fullscreen_Click(object sender, EventArgs e)
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Escape:
returnback();
break;
default:
break;
}
}
private void returnback()
{
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
}
相关文章推荐
- winfrom 窗体设置只能同时打开一次
- 窗体中有一个图片框,显示一副图片。要求:1)在窗体打开时,动态加载图片;2)设置图片显示模式为根据图片框大小缩放图片;3)图片自己找;4)当鼠标停留在图片框时,显示“**风光”提
- WinFrom窗体上的控件随着窗体的大小而自动调整比例
- Winfrom中怎么设置窗体大小的最小值,用鼠标改变窗体大小时,小到一定程度就小不了了
- 设置Iframe窗体大小
- 打开指定大小的新窗体
- C#设置窗体打开位置(在显示器的右下角打开)
- 如何设置打开的IE窗口大小?
- WinForm 设置窗体在桌面区域全屏显示
- windows启动时自动打开的应用程序窗口默认设置为全屏?
- 打开指定大小的模式窗体
- 设置窗体透明 隐藏任务栏 与全屏显示 .
- 设置窗体背景图片,并且让图片随着窗体的大小的调整而调整大小
- Js窗体window大小设置
- 设置屏幕全屏且无标题及获取屏幕大小
- 在asp.net中可以打开指定窗体大小,是在javascript中指定的
- 打开 ASP.NET 配置设置窗体
- C#设置窗体打开位置(在显示器的右下角打开)
- Js窗体window大小设置
- swf自动适应大小的变化,设置swf的全屏,支持退出全屏的esc快捷键