user536158
user536158

Reputation:

Change C# user control layout in windows forms development

I have a user control that contains multiple controls (CheckBox, Button, Label...). I want to change the layout of this user control to support right to left languages but i can't find how to do it.

Currently i can change the controls alignement using the RightToLeft property. But how can i change their positions?

Thank you for your time.

Upvotes: 1

Views: 2765

Answers (4)

user536158
user536158

Reputation:

Thank you guys for your answers but there is a better way to do it.

First we go to the user control properties and select the language property.
After changing it to another language a new resource file will be created for the user control.
After that, using the designer we can change the controls positions in the user control as we like. The new values will be saved in the created resource file.
When the language has changed, the corresponding resource file will be loaded and the positions will be changed.
If the language is a right to left one, don't forget to specify the right to left property for the controls.

Hope this helps.

Upvotes: 3

jamier
jamier

Reputation: 842

User control mirroring is not supported for user controls, see this connect article: http://connect.microsoft.com/VisualStudio/feedback/details/121202/usercontrol-mirroring-is-not-inherited-from-the-form

Their suggested workaround is to use a table layout panel which will mirror the controls in right to left.

Upvotes: 0

Renatas M.
Renatas M.

Reputation: 11820

Try to use FlowLayoutPanel or TableLayoutPanel to hold your controls and change panels RightToLeft property

Upvotes: 0

Related Questions