mdichild形式没有显示 [英] mdichild form not showing

查看:71
本文介绍了mdichild形式没有显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下是否有人遇到了同样的问题。我使用5个表单创建了一个vb.net应用程序,其中form1是父表单,另外4个是子表单。我已经包含了处理子表单所需的所有代码,并且它运行正常但是当我创建一个菜单来控制子表单时问题是当我关闭其中一个子表单然后单击菜单再次激活表单时,那里没有结果。菜单只适合关闭而不是显示。



这是代码。



< pre lang =vb> 公共 mw 作为 Form2 = Form2
公开 calc 作为 Form3 = Form3
公共 curr 作为 Form4 = Form4
公开 res 作为 Form5 = < span class =code-keyword> New Form5
Private Sub Form1_Load ( ByVal sender As System。 Object ByVal e As System.EventArgs)句柄 MyBase .Load
.IsMdiContainer = True

mw.Owner =
calc.Owner =
curr.Owner =
res.Owner =

mw.MdiParent =
calc.MdiParent =
curr.MdiParent =
res。 MdiParent =

res.Show()
curr.Show()
calc.Show()
mw.Show()

.LayoutMdi(MdiLayout.TileVertical)
结束 Sub

私有 Sub SampleMenuMW_Click( ByVal sender As System。 Object ByVal e As System.EventArgs) Handles SampleMenuM.Click
如果 mw IsNot 没什么 然后
mw.Close()
否则
mw.Show()
结束 如果
结束 Sub





非常感谢。

解决方案

这是一个想法:谁需要MDI,永远不会消失?为什么要折磨自己并吓跑你的用户?

帮自己一个大忙:根本不要使用MDI。没有它,您可以更轻松地实现设计,质量更好。 MDI甚至被微软高度劝阻,事实上,微软将其从WPF中删除并且很难支持它。更重要的是,如果您使用MDI,您将吓跑所有用户。只是不要。请参阅:

http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [ ^ ],

如何在WPF中创建MDI父窗口? [ ^ ]。



我可以解释做什么。请看我过去的答案:

为什么WPF本身不支持MDI表单? [ ^ ],

如何在WPF中创建MDI父窗口? [ Solution 2 ],

在WPF中使用MDI窗口的问题 [ ^ ],

MDIContainer给出错误 [ ^ ],

如何设置最大化的子表单,最小化最后一个子表单 [ ^ ]。



-SA


Hi, just would like to ask if someone encountered the same problem with mine. I have created a vb.net application using 5 forms which form1 is the parent form and the other 4 is the child. I already included all the codes necessary to handle the child forms and it is doing fine but when i created a menu to control the child forms the problem is when i close one of the child form then click the menu to activate the form again, there is no result. The menu is only good at closing but not on showing.

Here is the code.

 Public mw As Form2 = New Form2
    Public calc As Form3 = New Form3
    Public curr As Form4 = New Form4
    Public res As Form5 = New Form5
 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.IsMdiContainer = True

        mw.Owner = Me
        calc.Owner = Me
        curr.Owner = Me
        res.Owner = Me

        mw.MdiParent = Me
        calc.MdiParent = Me
        curr.MdiParent = Me
        res.MdiParent = Me

        res.Show()
        curr.Show()
        calc.Show()
        mw.Show()

 Me.LayoutMdi(MdiLayout.TileVertical)
End Sub

 Private Sub SampleMenuMW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SampleMenuM.Click
        If mw IsNot Nothing Then
            mw.Close()
        Else
            mw.Show()
        End If
    End Sub



Thank you very much.

解决方案

Here is the idea: who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don't. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
How to Create MDI Parent Window in WPF?[^].

I can explain what to do instead. Please see my past answers:
Why MDI form is not supported natively in WPF ?[^],
How to Create MDI Parent Window in WPF? [Solution 2],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

—SA


这篇关于mdichild形式没有显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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