I have a form. I've added the strip down button using drag and drop in the form. How can I (in the program) create and fill the toolStripMenu Item? My menu could contain different element...with different names.
about toolStripDropDownButton
4.4k views Asked by elisa At
2
There are 2 answers
0
On
For the DropDown property you need a ContextMenuStrip. The easiest way to find out how to fill it up is to drag&drop one from the toolbox onto your form, fill it up, select it in the DropDown property and afterwards take a look into the Designer.cs file to see how all the stuff is glued together.
The drawback of using the DropDownItems property is that you can't alter some properties like ShowImageMargin.
If you want to add items programmatically to a
ToolStripDropDownButtonjust do:Instead, if you need to add other
ToolStripDropDownButtonor other elements directly to you menu (ToolStrip), just do:EDIT:
You must do it after
InitializeComponent()otherwise you won't be able to access to design-time added components, e.g.: