Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
Een besturingselement voor Windows Forms CheckBox wordt gebruikt om gebruikers de opties Waar/Onwaar of Ja/Nee te geven. In de controle verschijnt een vinkje wanneer het is geselecteerd.
Opties instellen met selectievakjes
Bekijk de waarde van de eigenschap Checked om de status ervan te bepalen en gebruik die waarde om een optie in te stellen.
Wanneer in het onderstaande codevoorbeeld de CheckBox gebeurtenis van het CheckedChanged besturingselement wordt gegenereerd, wordt de eigenschap AllowDrop van het formulier ingesteld op
falseals het selectievakje is ingeschakeld. Dit is handig voor situaties waarin u gebruikersinteractie wilt beperken.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; } }
Zie ook
.NET Desktop feedback