vb.net 将文本与 Windows.Forms 中复选框的左侧对齐
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15886027/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Align text to left side of checkbox in Windows.Forms
提问by Don6558
I've checked the Checkbox class and searched to find a way to align the text to the left side of the checkbox and found nothing Windows Forms specific.
我检查了 Checkbox 类并搜索了一种将文本与复选框左侧对齐的方法,但没有发现任何特定于 Windows 窗体的内容。
Does anyone have any ideas?
有没有人有任何想法?
回答by Elias
CheckAlign
检查对齐
The CheckAlign property is the correct property to use in order to align a CheckBox's label. Even though the Right-to-Left property can get you the desired result (in certain instances), it is actually not correct.
CheckAlign 属性是用于对齐 CheckBox 标签的正确属性。尽管从右到左属性可以为您提供所需的结果(在某些情况下),但它实际上是不正确的。
Here is why the CheckAlign property is the correct property for moving the CheckBox's label while Right-to-Left is not:
这就是为什么 CheckAlign 属性是移动 CheckBox 标签的正确属性而从右到左不是的原因:
Right-to-Left deals with the language. Some spoken languages (such as Arabic/Hebrew) write their sentences right-to-left. So, using the Right-to-Left property on your Checkbox control is designed to coincide with the spoken language you are using as your label. Basically, if your label is in English (or Spanish, etc.) you would not want to use the Right-to-Left property.
从右到左处理语言。一些口语(如阿拉伯语/希伯来语)从右到左写句子。因此,在 Checkbox 控件上使用 Right-to-Left 属性旨在与您用作标签的口语一致。基本上,如果您的标签是英文(或西班牙文等),您就不会希望使用从右到左的属性。
CheckAlign deals with the checkbox's location. If you want your checkbox above, below, at 45°, or whatever then you would want to use the CheckAlign property.
CheckAlign 处理复选框的位置。如果您希望复选框位于上方、下方、45° 或其他任何位置,则您需要使用 CheckAlign 属性。
Let me give two examples that illustrate the differences.
让我举两个例子来说明差异。
? Example Number 1: Question CheckBox |C-Box with Label Text Set as: "Did you want this? []"
? 示例编号 1:问题复选框 |C 框,标签文本设置为:“您想要这个吗?[]”
Right-to-Left Property:No | Control's Appearance: "? Did you want this []"
CheckAlign Property:Middle-Right | Control's Appearance: "Did you want this? []"
从右到左的属性:否 | 控制的外观:“?你想要这个[]”
CheckAlign 属性:Middle-Right | 控制的外观:“你想要这个吗?[]”
? Example Number 2: Your label is written in Hebrew/Arabic and you want the text displayed properly (ie, rtl), but you also want the checkbox on the right. The Right-to-Left property can't do both. It's only good for one. Therefore, you must use the CheckAlign property.
? 示例 2:您的标签是用希伯来语/阿拉伯语书写的,并且您希望文本正确显示(即 rtl),但您还需要右侧的复选框。Right-to-Left 属性不能两者兼而有之。只对一个人好。因此,您必须使用 CheckAlign 属性。
Alright, long story short, if you want to orient the checkbox on any side of your label then the correct property to set is the CheckAlignProperty.
好吧,长话短说,如果您想在标签的任何一侧定位复选框,那么要设置的正确属性是CheckAlign属性。
Cheers
干杯

