Show toolbar via ToolStripDropDownButton.DropDownItems?
-
25-06-2021 - |
Question
In my toolbar, I have a System.Windows.Forms.ToolStripDropDownButton
where I want to show another toolbar. I managed to get it 'working' by adding my toolbar buttons to the DropDownItems
collection:
myToolbar.DropDownItems.AddRange(new ToolStripItem[]
{
myButton1,
myButton2,
myButton3
});
However, this produces a drop down menu with a lot of wasted space:
Instead of a menu, I want to show a toolbar. That is, I want my button images to be displayed side-by-side with no room for extra menu stuff (as shown above). Something like a toolbar button that says 'Command X' with a number of 'Sub command Y' items.
Thanks.
Solution
I don't think it's possible to get the total space of the margins to disappear without creating something on your own.
You can remove the darker margins though by doing this:
((ToolStripDropDownMenu)myToolbar.DropDown).ShowCheckMargin = false;
((ToolStripDropDownMenu)myToolbar.DropDown).ShowImageMargin = false;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow