有没有一种方法以编程方式最小化窗口 [英] Is there a way to programmatically minimize a window

查看:131
本文介绍了有没有一种方法以编程方式最小化窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做什么是我有一个全屏幕的形式,没有标题栏,因此缺乏最小化/最大化/在上层右上角找到关闭按钮。我想,以取代键盘快捷和上下文菜单项功能,但我似乎无法找到一个事件来触发,以尽量减少的形式。


解决方案

 私人无效Form1_KeyPress(对象发件人,KeyPressEventArgs E)
{
如果(e.KeyChar =='M' )
this.WindowState = FormWindowState.Minimized;
}


What I'm doing is I have a full-screen form, with no title bar, and consequently lacks the minimize/maximize/close buttons found in the upper-right hand corner. I'm wanting to replace that functionality with a keyboard short-cut and a context menu item, but I can't seem to find an event to trigger to minimize the form.

解决方案

private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
     if(e.KeyChar == 'm')
         this.WindowState = FormWindowState.Minimized;
}

这篇关于有没有一种方法以编程方式最小化窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆