简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM