Visual Studio 设计器表单中 ToolStrip 的自定义 ToolStripButton
我有自定义工具条按钮,
BindableToolStripButton : ToolStripButton
效果很好,但我不知道是否可以将此项目添加到设计菜单中进行控制。
我可以将 BindableToolStripButton 添加到设计器菜单吗?
I have custom tool strip button
BindableToolStripButton : ToolStripButton
It works well, but I don't know possibility to add this item to control in design menu..
Could I add my BindableToolStripButton to the designer menu?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在自定义 BindableToolStripButton 类定义之前添加此属性
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)]
Add this attribute before your custom BindableToolStripButton class definition
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)]
我也有同样的问题。当我将声明从 更改
为它对
设计师起作用时。
I had the same problem. when I changed the declaration from
to
it worked on the designer.
您必须从 ToolStripControlHost Class 派生,如下所示<一href="http://en.csharp-online.net/Tool,_Menu,_and_Status_Strips%E2%80%94Hosting_Other_Controls_in_the_ToolStrip" rel="nofollow">ESharp-online。
You have to derive from ToolStripControlHost Class like shown ESharp-online.