表单子类的子类显示为空
我正在编写一个应用程序,其中有不确定数量的表单,需要特定的弹出功能(类似于 MSN,屏幕右下角的一个小窗口)。 我写了第一个表格,然后认为我可以复制该文件来制作一个新表格。 到目前为止,一切都很好。 稍后我意识到我可以对 Form 进行子类化,编写我的弹出代码,然后对我的新 PopupForm
类进行子类化来制作其他表单,以简化重写弹出代码。 所以我这样做了,但现在我的表单没有在设计器中正确显示! 它们是完全白色的(没有背景图像或控件),我无法将新控件拖到上面。 我尝试将
[Designer("System.Windows.Forms.Design.FormDocumentDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(IRootDesigner))]
[DesignerCategory("Form")]
Form
类中的属性放在新表单上,但没有帮助。 我需要能够更改表单的内容,但我看不出有什么问题,所以这既令人烦恼又令人困惑。
I am writing an application where I have indeterminate amount of Forms
that require a certain popup-functionality (similar to MSN, a little window at the bottom right of the screen). I wrote the first form, then thought that I could copy the file to make a new one. So far so good. A bit later I realized that I could have subclassed Form, written my popup code, then subclassed my new PopupForm
class to make the other forms, to simplify rewriting the popup code. So I did that, but now my forms don't show up properly in the Designer! They are completely white (no background image or controls) and I can't drag new controls onto it. I tried placing the
[Designer("System.Windows.Forms.Design.FormDocumentDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(IRootDesigner))]
[DesignerCategory("Form")]
attributes from the Form
class on my new form, but it didn't help. I need to be able to alter the contents of my forms, and I don't see what's wrong, so this is both annoying and confusing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有多个构造函数,请确保您调用的是调用基本无参数构造函数的构造函数,即包含
InitializeComponent
的构造函数。If you have multiple constructors, make sure that you call the one which calls the base parameterless constructor, i.e. the one which contains
InitializeComponent
.