如何使托管选项卡控件(MTC)从右到左显示 [英] How to make Managed Tab Control (MTC) appear right to left

查看:119
本文介绍了如何使托管选项卡控件(MTC)从右到左显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用此TabControl 在Winform应用程序中创建以下TabLayout

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

如何使选项卡从右到左显示?
我的意思是使它像这张图片一样



我还尝试使用 RightToLeftLayout 属性,但此选项卡控件没有该属性

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

推荐答案

似乎受RightToLeft影响的MTC并未按预期绘制(部分原因是它静态地从左向右绘制制表符并进行计算左侧的宽度):

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):

在WinForms中很容易做到:

It's easy enough to do in WinForms:

秘密在于在您的表单上应用RightToLeft.

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.

请注意,RightToLeft被视为Ambient属性,因此子控件应从父控件继承(只要子控件未设置该属性).

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).

您可以在此处了解更多信息: https://msdn.microsoft.com/zh-CN/library/system.windows.forms.control.righttoleft(v=vs.110).aspx

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

您可以在此处阅读有关RightToLeftLayout的更多信息(请注意,此属性不会被子项继承):

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

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

这是将RightToLeft设置为yes&的表格. RightToLeftLayout设置为true:

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

这是将RightToLeft设置为yes,RightToLeftLayout设置为禁用的表单:

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

如果您想更好地控制布局,我建议阅读上面的MSDN文章.

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.

这篇关于如何使托管选项卡控件(MTC)从右到左显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆