Question

I can't seem to find any way to add a horizontal separator in a MenuStrip. Visual Studio complains Cannot add ToolStropSeparator to MenuStrip.

Any idea's how I can do this?

Was it helpful?

Solution

I'm able to run code like this:

this.menuMain.Items.Add(new ToolStripSeparator());

without any trouble... What kind of error are you getting?

OTHER TIPS

In the space between the two fields you want separated by the divider, type:

-

then hit enter (in the designer)

You can right-click the menustrip, then 'Insert' -> 'Separator'. That's all.

steps: 1. right click on contextmenuStrip items - > Insert -> Separator

OR

  1. a) Click on (Type Text box for ContextMenuStrip) where you want to put the horizontal separator, then enter" - "(Minus sign) b) Enter hope this will find you useful :)

I like to do mine with - rather then a separator. So say i wanna make a horizontal separator i would do about 30 of them to create a horizontal dotted line with a length of 30. Then i would set its enabled property to false so it can't be clicked as for a vertical one. Just do | then your item for each item and you will notice it will create a vertical line matching up with each item. [Note] The vertical line will be dotted due to the spacing between each item.

It' so simple,

Right click on the Context menu strip icon. then Select insert and after select Separator |

There are no separators for menu strip items.

However;

You can select the item you want a space between, and set the left or right margin value. This works just as well.

  1. Add The MenuStrip to Form
  2. Click MenuStrip And Click Items "..." In Properties Window
  3. In Opened Window in Section "Select item and add to list below" Click Add
    For Example For 3 Then Select the for example toolStripMenuItem1 and Click DropDownItems "..." Then in Section to New Opened Window "Select item and add to list below" Select Separator | And Add it. Good Lock
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top