VS 05 - 设计器属性和组件设计器。 它们有何关系?
我在另一篇文章上得到了这个答案,我问:
“我相信 VS 设计器通过获取控件设计器的实例(请参阅 Designer 属性)来实现[菜单条/状态条的组件],并且如果设计器是 ComponentDesigner,则获取 AssociatedComponents 属性。”
我该怎么做呢? 我什至不知道从哪里开始......
I had this answer on another post I asked:
"I believe the VS designer does it [components of a menustrip/statusstrip] by getting an instance of the control's designer (see the Designer attribute), and, if the designer is a ComponentDesigner, getting the AssociatedComponents property."
How do I do this? I'm not even sure where to begin...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DesignerAttribute
属性可以附加到 WinForms 中的Control
或Component
类,以指示实现用于可视化编辑该类型控件的设计器的类或组件。 例如,Form
类有一个DesignerAttribute
,它指示名为FormDocumentDesigner
的类实现其设计器。设计器允许在 Visual Studio 的 WinForms 设计器中应用特殊的设计时行为,例如调整列表视图列的大小或控件上的大小调整手柄。 支持向现有控件添加子控件的设计器(例如
FormDocumentDesigner
)最终派生自ComponentDesigner
。您可以使用 .NET Reflector 等工具来检查这一点。
The
DesignerAttribute
attribute can be attached to aControl
orComponent
class in WinForms to indicate the class that implements a designer for visually editing that type of control or component. For example, theForm
class has aDesignerAttribute
that indicates a class calledFormDocumentDesigner
implements its designer.Designers allow special design-time behavior to be applied in the WinForms designer in Visual Studio such as list view column resizing or the sizing handles on controls. Designers that support the addition of child controls to an existing control, such as
FormDocumentDesigner
are ultimately derived fromComponentDesigner
.You can check this out by using a tool like .NET Reflector.