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

Gets or sets a value indicating whether the check box will allow three check states rather than two.

[Visual Basic]
Public Property ThreeState As Boolean
[C#]
public bool ThreeState {get; set;}
[C++]
public: __property bool get_ThreeState();
public: __property void set_ThreeState(bool);
[JScript]
public function get ThreeState() : Boolean;
public function set ThreeState(Boolean);

Property Value

true if the CheckBox is able to display three check states; otherwise, false. The default value is false.

Remarks

Note   When the ThreeState property is set to false, the Indeterminate value of the CheckState property is not valid.

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