views:

432

answers:

1

Hi everyone, I need to change the contextmenustrip width dynamically, by default the contextmenustrip width depends on the text length of the ToolstripmenuItems.

And BTW I really don't wanna redraw the control again!!!

Thanks in advance.

+1  A: 

You need to set the ContextMenuStrip AutoSize property to false. Then you can set the Width property to whatever you want. When AutoSize is set to true, the Width property is ignored and is calculated dynamically.

Example:

Dim menu As New ContextMenuStrip()
menu.AutoSize = False
menu.Width = 100
Joshua Poehls