【C#】C#winform 双击/按"F12"键全屏,按"Esc"键退出
2016-12-19 10:43
357 查看
private void Lottery_DBClick(object sender, EventArgs e)
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;// 设置边框为 None
this.WindowState = FormWindowState.Maximized;// 最大化
this.TopMost = true;// 置顶
this.KeyPreview = true;// 允许窗体先收到键盘事件
this.KeyUp += new KeyEventHandler(Lottery_KeyUp);// 允许窗体先收到键盘事件
this.Show();//显示 Form
}
private void Lottery_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)//"Esc"按键退出全屏
{
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
}
if (e.KeyCode == Keys.F12)
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;// 设置边框为 None
this.WindowState = FormWindowState.Maximized;// 最大化
this.TopMost = true;// 置顶
this.KeyPreview = true;// 允许窗体先收到键盘事件
this.KeyUp += new KeyEventHandler(Lottery_KeyUp);// 允许窗体先收到键盘事件
this.Show();//显示 Form
}
}
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;// 设置边框为 None
this.WindowState = FormWindowState.Maximized;// 最大化
this.TopMost = true;// 置顶
this.KeyPreview = true;// 允许窗体先收到键盘事件
this.KeyUp += new KeyEventHandler(Lottery_KeyUp);// 允许窗体先收到键盘事件
this.Show();//显示 Form
}
private void Lottery_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)//"Esc"按键退出全屏
{
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
}
if (e.KeyCode == Keys.F12)
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;// 设置边框为 None
this.WindowState = FormWindowState.Maximized;// 最大化
this.TopMost = true;// 置顶
this.KeyPreview = true;// 允许窗体先收到键盘事件
this.KeyUp += new KeyEventHandler(Lottery_KeyUp);// 允许窗体先收到键盘事件
this.Show();//显示 Form
}
}
相关文章推荐
- C#中Winform的Treeview节点"正在展开..."的效果
- C#编写的winform程序绑定comboBox成功,添加一个默认的文字选项"请选择"
- C# Winform 怎么让界面全屏显示
- C#强制退出WinForm程序之Application.Exit和Environment.Eixt
- C#中双击标题栏关闭WinForm程序
- c# winform加载窗体自动最大化,非全屏,不会遮盖任务栏
- C# WinForm 关于窗体最大化时的是否全屏效果与是否遮盖任务栏
- Adobe AIR 全屏及阻止Esc退出全屏方法
- C# esc退出窗体
- C#中Winform的Treeview节点"正在展开..."的效果
- [转]C# WinForm 关于窗体最大化时的是否全屏效果与是否遮盖任务栏
- Winform使用C#实现Treeview节点"正在展开..."效果
- (转)C# WinForm 关于窗体最大化时的是否全屏效果与是否遮盖任务栏
- C#中Winform的Treeview节点"正在展开..."的效果
- C# WinForm 关于窗体最大化时的是否全屏效果与是否遮盖任务栏
- C# WinForm 关于窗体最大化时的是否全屏效果与是否遮盖任务栏
- C#编写的winform程序绑定comboBox成功,插入默认选项"请选择"
- C# WinForm程序退出的方法
- C# 实现WinForm 全屏
- c# winform程序调用托管dll(c#的dll),使用"添加引用"和动态加载dll