MDIContainer提供错误 [英] MDIContainer giving error

查看:114
本文介绍了MDIContainer提供错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试检查活动表单是否为MDIContainer时,我一直收到空引用错误.对象引用未设置为对象的实例.

这是我尝试的方法:

When I try to do a check to see that the active form is an MDIContainer, I keep getting an null reference error. Object reference not set to an instance of an object.

This is what I try:

if(form.ActiveForm.IsMdiContainer)


有时,即使我将子窗体的MdiParent设置为MDIcontainer,也会在MDI容器外部打开子窗体.

MDIContainer甚至可以很好地使用,还是我应该寻找更好的东西?


Also some times a child form will open outside of the MDI container even though I set the MdiParent of that child form to the MDIcontainer.

Is MDIContainer good to use even or is there something better I should be looking at?

Any help would be greatly appreciated

推荐答案

查看表单属性,找到所有包含子字符串"MDI"的内容,它将说明如何使用MDI. MDIContainer是您需要定义的内容.

我有更好的建议:

但是请帮个忙,听听我的友善建议:不要做MDI
没有那么多UI设计如此麻烦和麻烦!我认识的每个人(而且我认识很多计算机人员,而不仅仅是开发人员)都讨厌这样的用户体验,并且非常同意我的看法.您找不到使用这种设计的任何认真的公司或UI开发人员.

而是使用选项卡式UI,或可停靠(或组合),或由树/列表视图TOC页样式控制,或折叠面板或类似的东西.

—SA
Look at the form properties and find all of them containing sub-string "MDI", it will explain how to use MDI. MDIContainer is something you need to define.

I have a better advice:

But do yourself a favor, listen to my good friendly advice: don''t do MDI!
There are not so many UI designs that are so inconvenient and cumbersome! Everyone I know (and I know very many computer people, not just developers) hate such user experience and well agree with me. You cannot find any serious company or UI developer using such design.

Instead, use tabbed UI, or dockable (or combined), or controlled by tree/list view TOC-page style, or folding panels or something like that.

—SA


在调试模式下运行且发生异常时,将鼠标指针悬停在语句中的每个单词上.

您应该看到的工具提示将告诉您哪个是null.我的猜测是ActiveForm,但只有您可以确定这一点.

一旦发现了罪魁祸首,您将需要考虑可能的原因.
When you run in debug mode and the exception occurs, hover your mouse pointer over each word in your statement.

The tooltip you should see will tell you which is null. My guess would be ActiveForm but only you can determine this for certain.

Once you have discovered the culprit you will need to think about the reason(s) that might be.


这篇关于MDIContainer提供错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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