mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
2.6 KiB
2.6 KiB
title, ms.date, dev_langs, f1_keywords, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | f1_keywords | helpviewer_keywords | ms.assetid | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Set Options with CheckBox Controls | 03/30/2017 |
|
|
|
2ac70498-7e3e-4e07-8901-ccabaeb5fd3e |
How to: Set Options with Windows Forms CheckBox Controls
A Windows Forms xref:System.Windows.Forms.CheckBox control is used to give users True/False or Yes/No options. The control displays a check mark when it is selected.
To set options with CheckBox controls
-
Examine the value of the xref:System.Windows.Forms.CheckBox.Checked%2A property to determine its state, and use that value to set an option.
In the code sample below, when the xref:System.Windows.Forms.CheckBox control's xref:System.Windows.Forms.CheckBox.CheckedChanged event is raised, the form's xref:System.Windows.Forms.Control.AllowDrop%2A property is set to
falseif the check box is checked. This is useful for situations where you want to restrict user interaction.Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged ' Determine the CheckState of the check box. If CheckBox1.CheckState = CheckState.Checked Then ' If checked, do not allow items to be dragged onto the form. Me.AllowDrop = False End If End Subprivate void checkBox1_CheckedChanged(object sender, System.EventArgs e) { // Determine the CheckState of the check box. if (checkBox1.CheckState == CheckState.Checked) { // If checked, do not allow items to be dragged onto the form. this.AllowDrop = false; } }private: void checkBox1_CheckedChanged(System::Object ^ sender, System::EventArgs ^ e) { // Determine the CheckState of the check box. if (checkBox1->CheckState == CheckState::Checked) { // If checked, do not allow items to be dragged onto the form. this->AllowDrop = false; } }