WinForms:在设计器中将自定义 ToolStripMenuItem 添加到 MenuStrip [英] WinForms: Adding custom ToolStripMenuItem to MenuStrip in designer
本文介绍了WinForms:在设计器中将自定义 ToolStripMenuItem 添加到 MenuStrip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Windows 窗体中 如果我制作了一个从 ToolStripMenuItem
继承的自定义控件,是否有办法将此 CustomToolStripMenuItem
添加到设计器的 MenuStrip
或我必须通过代码来完成吗?(因为 ToolStripMenuItem
是在没有从工具箱中拖动它们的情况下添加的)
In Windows Forms If I make a custom control that inherits from ToolStripMenuItem
is there a way to add this CustomToolStripMenuItem
to MenuStrip
from designer or do I have to do it through code? (since the ToolStripMenuItem
are added without dragging them from the toolbox)
推荐答案
尝试用这个属性装饰它:
Try decorating it with this attribute:
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.MenuStrip)]
public class MyToolStrip : ToolStripMenuItem {
}
这篇关于WinForms:在设计器中将自定义 ToolStripMenuItem 添加到 MenuStrip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文