NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

CheckBox.CheckAlign

Gets or sets the horizontal and vertical alignment of a check box on a check box control.

[Visual Basic]
Public Property CheckAlign As ContentAlignment
[C#]
public ContentAlignment CheckAlign {get; set;}
[C++]
public: __property ContentAlignment get_CheckAlign();
public: __property void set_CheckAlign(ContentAlignment);
[JScript]
public function get CheckAlign() : ContentAlignment;
public function set CheckAlign(ContentAlignment);

Property Value

One of the ContentAlignment values. The default value is MiddleLeft.

Exceptions

Exception Type Condition
InvalidEnumArgumentException The value assigned is not one of the ContentAlignment enumeration values.

Example [Visual Basic]

The following code example will display the values of four properties and displays them in a label. The ThreeState property alternates between true and false with every click of the button and the CheckAlign alternates between MiddleLeft and MiddleRight. This example will allow you to see how the property values change as the ThreeState property changes and the button is checked. This code assumes a CheckBox, Label and Button have all been instantiated on a form and the lanbel should be large enough to display four lines of text..

[Visual Basic]

Private MySub()
   ' Concatenate the property values together on four lines.
   Label1.Text = "ThreeState: " & CheckBox1.ThreeState & vbCrLf & _
     "Checked: " & CheckBox1.Checked & vbCrLf & _
     "CheckState: " & CheckBox1.CheckState & vbCrLf & _
     "AccessibleState: " & CheckBox1.AccessibleState  
   
   ' Change the ThreeState and CheckAlign properties on every other click.
   If CheckBox1.ThreeState = False Then
      CheckBox1.ThreeState = True
      CheckBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
   Else
      CheckBox1.ThreeState = False
      CheckBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleLeft
   End If
End Sub

See Also

CheckBox Class | CheckBox Members | System.WinForms Namespace | TextAlign