winform没有显示其设计 [英] winform not showing its design

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

问题描述

我最近从Windows 7升级到Windows 8,现在我在Visual Studio 2010上用c#开发的项目不再正常。我的主要表格有一个来自Janus工具包的色带,这个表格没有显示包括所有其他控件的设计。





但它显示此错误。我怎样才能最好地解决问题。



此错误的实例(1)



I have recently upgraded from windows 7 to windows 8 and now my project which I was developing in c# on Visual studio 2010 is no longer behaving normal. My main form has got a ribbon from the Janus tool kit, this form is not showing the design including all the other controls on it.


But instead it shows this error. how best can I solve the problem.

Instances of this error (1)

Hide Call Stack 
 
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at System.ComponentModel.ReflectPropertyDescriptor.ResetValue(Object component)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.ResetBrowsableProperties(Object instance)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollecton statements)





问候



George Tsiga



Studen t



Regards

George Tsiga

Student

推荐答案

这是我称之为设计师过度使用的结果。很多时候,人们会遇到一些对应用程序运行时并不重要的错误,但在设计会话期间,您的某些表单可能无法加载,因为您有一些例外。



首先,您需要在设计模式下恢复表单的功能。这样做,您应该暂时删除可能危及此功能的所有代码。但是您可以保留所有这些代码,只需要在设计模式下调用代码片段就可以跳过它们。为此,请检查属性 DesignMode

This is a result of what I call "designer overuse". Very often, people run into some bugs which are not critical for application runtime, but during design session, some of your forms may not load, because you have some exception.

First of all, you need to restore the functionality of your form in design mode. Do to so, you should temporarily remove all code which may compromise this functionality. But you can leave all this code as is, you only need to skip some fragment of code when it may be called in design mode. To do so, check up the property DesignMode:
if (DesignMode) {
    // Some questionable code
}



请参阅: http://msdn.microsoft.com/en-us/library/system.componentmodel.component.designmode.aspx [ ^ ]。



这个简单的技巧是真的是救生员!



恢复代码时该怎么办?下次,尽量不要过度使用设计师。理想情况下,它只应用于提供表单的布局。 (顺便说一句,对于desiner创建的布局,不要使用手动定位,只使用 Dock Anchors 填充属性。)我甚至在手动编写的代码中添加了一些微调控件。您需要了解在设计器中添加太多控件意味着需要大量繁琐的手动猴子工作,而在代码中您可以使用计算,循环等。我还建议您避免在设计模式下添加任何事件处理程序。顺便说一下,添加事件处理程序(' + = ')的自动生成代码有点过时,使用匿名语法的代码更加可支持。



-SA


Please see: http://msdn.microsoft.com/en-us/library/system.componentmodel.component.designmode.aspx[^].

This simple technique is really a life saver!

What to do when you recover your code? Next time, try not to overuse the designer. Ideally, it should only be used to provide a layout of your form. (By the way, for desiner-created layout, don't use manual positioning, only make layout using the combination of Dock, Anchors and Padding properties.) I even add some fine-tuned controls in manually written code. You need to understand that adding too many controls in designer means a lot of tedious manual monkey work, while in code you can use calculations, loops, etc. I also usually recommend to avoid adding any event handlers in design mode. By the way, auto-generated code for adding event handlers ('+=') is somewhat obsolete, the code using anonymous syntax is much more supportable.

—SA


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

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