Width of ContextmenuStrip

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

And by the way, I really don't want to redraw the control again.

Thanks in advance.

+3
source share
2 answers

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

Example:

Dim menu As New ContextMenuStrip()
menu.AutoSize = False
menu.Width = 100
+3
source

AutoSize "" . , , .

... , ... , .

0

Source: https://habr.com/ru/post/1705332/


All Articles