如何在自定义控件的“属性”窗口中创建链接?
在 .NET Framework 中,有多个控件在 Visual Studio 设计器的“属性”窗口中的属性列表下方列出了许多链接。 (例如TabControl、ComboBox)
我已经构建了一个自定义控件,并且我想在属性窗口上创建一个链接,如TabControl 和ComboBox。单击链接时,应该调用我的控件上的某个方法。
我该怎么做?
谢谢!
In the .NET Framework, there are several controls that list a number of links underneath the property list in the Properties window in the Visual Studio designer. (e.g. TabControl, ComboBox)
I have built a custom control, and I want to create a link on the Properties Window like the TabControl and ComboBox. When the link is clicked, a certain method on my control should be called.
How can I do this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要为您的控件创建一个自定义设计器并覆盖
Verbs
属性。第一次调用重写时,创建一个DesignerVerbCollection
并填充它。在每次后续调用时返回集合。编辑:顺便说一下,您可以通过从 System.Windows.Forms.Design.ControlDesigner 派生来创建设计器,并通过将此属性放在类上来将其应用到您的类:
You need to create a custom designer for your control and override the
Verbs
property. The first time your override is called, create aDesignerVerbCollection
and populate it. Return the collection on each subsequent call.Edit: By the way, you create the designer by deriving from
System.Windows.Forms.Design.ControlDesigner
and you apply it to your class by putting this attribute on your class:我认为您正在寻找 DesignerVerb班级。
I think you're looking for the DesignerVerb class.
devarticles< /a>
}
devarticles
}