Remove .net ContextMenuStrip Padding
- by Frosty840
Hi,
When creating a ContextMenuStrip, there is a huge amount of padding around the contained controls.
For example:
Me.myMenu = New ContextMenuStrip
'unset all obvious padding settings'
Me.myMenu.ShowCheckMargin = False
Me.myMenu.ShowImageMargin = False
Me.myMenu.Margin = New System.Windows.Forms.Padding(0)
Me.myMenu.Padding = New System.Windows.Forms.Padding(0)
Dim addButton As New Button
addButton.Size = New Size(60, 60)
addButton.Text = "Button"
Dim addControlHost As New ToolStripControlHost(addButton)
Me.myMenu.Items.Add(addcontrolhost)
Me.ContextMenuStrip = Me.myMenu
This, ideally, would cause a 60x60 button to pop up at the cursor location.
What actually pops up is this:
The button is there, as expected, but despite there being no margin, no padding, and having set both Show*Margin settings to False, there is a massive border around the Button.
I'm probably missing something blindingly obvious, but how can I get rid of all the white bordering, especially that huge right-hand margin?