Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align text to left side of checkbox in Windows.Forms

Tags:

vb.net

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.

Does anyone have any ideas?

like image 523
Don6558 Avatar asked Apr 08 '13 18:04

Don6558


1 Answers

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.

Here is why the CheckAlign property is the correct property for moving the CheckBox's label while Right-to-Left is not:

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.

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.

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? []"

  • Right-to-Left Property: No | Control's Appearance: "? Did you want this []"

  • CheckAlign Property: Middle-Right | Control's Appearance: "Did you want this? []"

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

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 CheckAlign Property.

Cheers

like image 124
Elias Avatar answered Sep 20 '22 08:09

Elias