博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

用键盘退出全屏 键盘事件

Posted on 2009-07-27 20:02  澍可  阅读(318)  评论(0编辑  收藏  举报
        private void Form2_KeyUp(object sender, KeyEventArgs e)
        {
            
if (e.KeyData == Keys.Escape)
            {
                
this.TopMost = false;
                
this.FormBorderStyle = FormBorderStyle.Sizable;
                
this.WindowState = FormWindowState.Normal;
                FillScreenbtn.Text 
= "全屏";
            }
        }
注意:窗体的KeyPreview属性 设为true。