Windows窗体中的设计时错误 [英] design-time error in windows form

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

问题描述





错误是在模块commonLanguageRuntime Library中找不到类型system.diagnostics.debuggerdisplay属性



im在我的应用程序中以所有形式获取此设计时错误...如何解决



提前感谢

darshan

Hi

The error is " Cannot find type system.diagnostics.debuggerdisplay attribute in module commonLanguageRuntime Library "

i m getting this design time error in all forms in my application ...how to solve that

thanks in advance
darshan

推荐答案

这不是真正的设计时间。这是正常的编译错误。好吧,找到这个属性并使代码正确使用它。但更重要的是,从设计层面删除与基本表单设计相关的所有内容,并避免麻烦。我建议仅将设计师用于一般表格或用户控制布局。



现在,我想提前告知编译成功的情况,但是设计时的一些例外情况会阻止您打开设计视图。这是一个非常典型的问题,源于设计师的过度使用。使用控件,这不是那么容易,因为它们是自定义的并且设计为包含一些高级行为。这是一个奇迹工具:正确使用所有控件的属性 System.ComponentModel.Component.DesignMode 。您可以使用此属性的检查来保护与使用设计器过程中使用的布局无直接关系的任何内容:



This is not really design-time. This is a normal compilation error. Well, find this attribute and make the code using it properly. But more importantly, remove everything not related to basic form design stuff from design level, and stay our of trouble. I would advise to use the designer only for general form or user control layout.

Now, I would like to advise in advance for the cases when compilation is successful, but some exceptions during design time prevents your from opening design views. This is a very typical problem stemmed from the overuse of the designer. With controls, this is not so easy, because they are custom and designed to include some advanced behavior. Here is one miracle tool: the proper use of the property System.ComponentModel.Component.DesignMode for all your controls. You can safeguard anything not directly related to layout used in the process of using the designer with the check of this property:

// in the code of some Control or other Component:
if (!this.DesignMode) {
    // do something risky not related to basic layout behavior here
}





这个简单的技巧可以让你免于麻烦。< br $>


-SA


这篇关于Windows窗体中的设计时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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