[英]Adding custom menu item to ToolStripMenuItem's collection list
I'm building my own ToolStripMenuItem and I want it to show up in the list of choices to add to a Menu's DropDownItems collection. 我正在构建自己的ToolStripMenuItem,并且希望它显示在要添加到Menu的DropDownItems集合的选项列表中。 How do I do that? 我怎么做?
Here's what I have so far. 到目前为止,这就是我所拥有的。
imports System.ComponentModel
''' <summary>
''' A list of check box items that remember which item is currently checked
''' </summary>
public class ToolStripCheckItemList : inherits ToolStripMenuItem
private itemsList as List(of Object)
event checkedItemChanged(sender as Object, e as EventArgs)
<Category("Items"), _
Description("The list of items contained in the check list.")>
public property items() as List(of Object)
set
End Set
Get
return itemsList
End Get
End Property
end class
This is the attribute I needed. 这是我需要的属性。 I put it right above my class name. 我把它放在班级名称的正上方。
<ToolStripItemDesignerAvailabilityAttribute(ToolStripItemDesignerAvailability.MenuStrip)>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.