恢复事件后表单大小出现问题
我有一个 Mdi 应用程序,其中包含 1 个父表单和 3 个子表单。 父窗体大小总是这样计算:
this.Size = ActiveMdiChild.Size;
this.Height +=150; // because there is a control at the bottom of Parent form
问题是,当我最小化父窗体,然后恢复它时,恢复后它的大小减少了 20。所以窗体看起来有点扭曲。在我的代码中,我没有指定它来减小它的大小,因此它应该在恢复后返回到之前的大小。我想这可能是一个错误。所以我想知道如何才能避免这种情况。我的想法是捕获恢复事件,然后将表单大小更改为应有的大小,但我不知道如何捕获恢复事件。
I have a Mdi application with 1 Parent form and 3 Child forms.
Parent Form size is always calculated like this:
this.Size = ActiveMdiChild.Size;
this.Height +=150; // because there is a control at the bottom of Parent form
Problem is, when I minimize Parent Form, and then restore it, its size after restore has decreased by 20. So the form looks kinda distorted. In my code, I haven't specified it to decrese it's size so it should return to it's earlier size after restore. I guess it could be a bug. So I was wondersing how I could avoid this. My idea was to catch the restore event, and then change form size to what it should be, but I don't know how to catch restore event.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过重写 WndProc 来做到这一点:
You can do this by overriding WndProc: