防止Winform最大化? [英] Preventing Winform from getting maximized?

查看:127
本文介绍了防止Winform最大化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想防止桌面应用程序最大化.不应通过任何方式使它最大化-双击标题栏,或单击键盘上的Windows +向上箭头,等等.
-我同时禁用了MaximizeBox和MinimizeBox.
-我还为WinForm设置了MaximumSize和MinimumSize
仍然当我按下 Windows +向上箭头时,我的获胜形式移到屏幕的左上方,我的意思是它将最大化.
因此,请告诉我任何防止这种情况发生的方法...

I want to prevent my desktop application from being maximized. It should not become maximized by any means - by double clicking on title bar, or by clicking Windows + Up arrow on the keyboard, etc.
- I disable both the MaximizeBox and MinimizeBox.
- I also set the MaximumSize and MinimumSize for my WinForm
Still when I press Windows + Up arrow, my win form Shifts to top left of the screen, I mean it gets maximized.
So please tell me any way to prevent this thing happening...

推荐答案

您可以将最大大小设置为您想要的大小,然后不能超过此范围.

您还可以处理大小更改事件,并在其中检查状态是否已最大化,如果是,则将其改回.
you can set the maximum size to be the size you want it to be, then it shouldn''t maximize past that.

You can also handle the size changed event and check there if the state is maximized, and if it is, change it back.


这篇关于防止Winform最大化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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