C++ CheckBox Control.
The C++ CheckBox control allows the user to choose or tick all that apply type questions from a list of options. The RadioButton is similar, but where the RadioButton only allows you to choose one item within the parent control as Yes/No, Male/Female, True/False etc, the CheckBox cotrol allows the user to choose from a combination of options.
Namespace: System::Windows::Forms
System.Windows.Forms (in system.windows.forms.dll)
Creating an new C++ Windows forms CheckBox.
CheckBox^ checkbox = gcnew CheckBox;
Assigning a new location for the C++ Windows Forms CheckBox.
checkbox->Location = Point(30,30);
Assigning a text value to the C++ CheckBox control.
checkbox->Text = "select this?";
Setting the check state of the CheckBox Control.
checkbox->Checked = true;
Adding a C++ CheckBox control to the form.
Controls->Add(checkbox);
Creating a CheckBox CheckedChanged Event for the C++ CheckBox control.
checkbox->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkbox_CheckedChanged);
Responding to the C++ CheckBox CheckedChanged event.
private: System::Void checkbox_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
{
MessageBox::Show("Check Changed");
}
|