Matthew Layton
Matthew Layton

Reputation: 42260

How do you keep a ToolStripSplitButton within the bounds of its container

I am developing a windows forms application with C#

My main form has a toolstrip with a ToolStripSplitButton which is aligned to the right. When the split button is clicked, its menu displays over the edge of the form, unless, the form is too close to the far right hand side of the screen.

I have played with various properties to try and solve this, but without much luck!

Is there anything (maybe even a DllImport), that can force the button's menu to always fold in and towards the form, and never exceed the forms bounds?

Upvotes: 1

Views: 513

Answers (1)

John Willemse
John Willemse

Reputation: 6698

As worked out in the comments on the OP, if you don't use images in the sub-items of the ToolStripSplitButton, this is an easy solution:

1) Set the RightToLeft property of the ToolStripSplitButton itself to Yes

2) Set the RightToLeft property of all sub-items to No to align the text correctly.

Upvotes: 1

Related Questions