Nasıl yapılır: Windows Forms CheckBox Denetimleriyle Seçenekleri Ayarlama
Windows Forms CheckBox denetimi, kullanıcılara Doğru/Yanlış veya Evet/Hayır seçenekleri vermek için kullanılır. Denetim seçildiğinde bir onay işareti görüntüler.
CheckBox denetimleriyle seçenekleri ayarlamak için
Durumunu belirlemek için özelliğin Checked değerini inceleyin ve bir seçenek ayarlamak için bu değeri kullanın.
Aşağıdaki kod örneğinde, denetimin CheckBoxCheckedChanged olayı tetiklendiğinde, onay kutusu işaretliyse formun AllowDrop özelliği olarak
false
ayarlanır. Bu, kullanıcı etkileşimlerini kısıtlamak istediğiniz durumlarda kullanışlıdır.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 Sub
private 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; } }
Ayrıca bkz.
.NET Desktop feedback
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin