How to make Managed Tab Control (MTC) appear right to left

笑着哭i 提交于 2019-12-25 18:46:13

问题


I have used this TabControl to create the following tablayout in a winform application

How do i make the tabs appear right to left?
I mean make it like this image



I also tried to Use RightToLeftLayout property but this tab control doesn't have that property


回答1:


It seems that MTC while affected by RightToLeft doesn't draw as expected (In part due to the fact that it statically draws the tabs from left to right and calculates width from the left):

It's easy enough to do in WinForms:

The secret is to apply RightToLeft on your form.

In the properties panel for your form ensure the following are set to Yes and True respectively.

Note that RightToLeft is considered an Ambient property, so child controls should inherit from the parent (so long as the child control doesn't have the property set).

You can read more about that here: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.righttoleft(v=vs.110).aspx

You can read more about RightToLeftLayout here (note that this property does NOT get inherited by children):

https://msdn.microsoft.com/en-us/library/system.windows.forms.form.righttoleftlayout(v=vs.110).aspx

This is the form with RightToLeft set to yes & RightToLeftLayout set to true:

This is the form with RightToLeft set to yes, and RightToLeftLayout set to disabled:

I suggest reading the MSDN articles above if you'd like to have more control over the layout.

Edited: Added additional imagery to show the function of the various properties.



来源:https://stackoverflow.com/questions/40047358/how-to-make-managed-tab-control-mtc-appear-right-to-left

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!