本文介绍了子窗体的最大化状态在 MDI 容器中使用时无法正常工作 (Visual Basic 2013)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Basic (2013) 中遇到了这个奇怪的问题.我在 MDI 容器中有一个表单.它们都具有 WindowStateMaximized 的属性.在执行时,MDI 容器以最大化状态加载(到目前为止还好!).但是,当我打开子窗体时,它不会给出实际最大化状态的外观(尽管右上角的还原"按钮显示它已加载到最大化状态,但并未最大化).>

我什至在 form1.Show() 之前和之后都尝试过 form1.WindowState = FormWindowState.Maximized,但没有成功.

我也附上了截图.注意MDI容器的死区和子窗体的恢复图标(表示子窗体处于最大化状态).

很少观察 -

  1. 当我恢复并再次最大化它时,它确实最大化了.

  2. 我也观察到这个问题只出现一次.我的意思是,如果我有 2 个表单都设置为在最大化状态下加载.当我打开第一个表单(无论哪个)时,它会像我在屏幕截图中显示的那样加载,然后当我打开第二个表单时,它以最大化状态加载.

我想不通,出了什么问题?如何纠正?

解决方案

转到您的表单属性.设置 windowsState = 正常.然后把它放到代码中

 Dim frmC As New frmChildfrmC.MdiParent = 我frmC.WindowState = FormWindowState.MaximizedfrmC.Show()

I am having this weird problem in Visual Basic (2013). I have a form in MDI container. Both of them, have property WindowState to Maximized. While executing, MDI container loads in maximized state (So far Ok!). But, when I open the child form, it Does NOT give the Actual Maximized state appearance (although Restore button on top right shows that it has loaded in maximized state, but it did not maximized).

I even tried with form1.WindowState = FormWindowState.Maximized both before and after form1.Show(), but no luck.

I have attached a screenshot too. Note the dead space of MDI container and Restore icon of child form (which means child form is in maximized state).

Few observations -

  1. When I restore and then again maximize it, it DOES maximize correctly.

  2. I also observed that this problem is occurs only for one time. I mean, if I have 2 forms both set to load in Maximized state. When I open the first form (no matter which), it loads like i showed in the screenshot, and after that when I open 2nd form, it loads in maximized state.

I could not figure out, what went wrong? How to correct this?

解决方案

go to your form properties. Set windowsState = normal. then put this to code

    Dim frmC As New frmChild
    frmC.MdiParent = Me
    frmC.WindowState = FormWindowState.Maximized
    frmC.Show()

这篇关于子窗体的最大化状态在 MDI 容器中使用时无法正常工作 (Visual Basic 2013)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 18:21