Visual Studio 设计器表单中 ToolStrip 的自定义 ToolStripButton

发布于 2024-11-26 15:50:14 字数 244 浏览 3 评论 0原文

我有自定义工具条按钮,

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..

enter image description here

Could I add my BindableToolStripButton to the designer menu?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

弥枳 2024-12-03 15:50:14

在自定义 BindableToolStripButton 类定义之前添加此属性

[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)]

Add this attribute before your custom BindableToolStripButton class definition

[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)]

沉睡月亮 2024-12-03 15:50:14

我也有同样的问题。当我将声明从 更改

class MyToolStripButton : ToolStripButton

为它对

public class MyToolStripButton : ToolStripButton

设计师起作用时。

I had the same problem. when I changed the declaration from

class MyToolStripButton : ToolStripButton

to

public class MyToolStripButton : ToolStripButton

it worked on the designer.

人疚 2024-12-03 15:50:14

您必须从 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文