30 Ekim 2015 Cuma

CheckBox Kontrolü

İki yada üç duruma sahip olabilen, onay ve seçim işlemleri için kullanılan bir kontroldür.

CHECKBOX KONTROLÜNÜN ÖZELLİKLERİ


·         Checked: True değerini aldığında CheckBox nesnesi işaretlidir, False değerini aldığında ise işaretli değildir.
·         CheckState: 3 değer alır
           Unchecked: İşaretsiz
           Checked: İşaretli
           Indeterminate: Belirsiz.
·         ThreeState: CheckBox’ın Checked, Unchecked şeklindeiki değer değil de, Checked,Unchecked ve Indeterminate şeklinde üç değer almasını sağlar.

·         FlatStyle: CheckBox nesnesinin görünüm şeklini değiştirir. Aldığı değerler ve bunun sonucunda oluşan görünüm şekilleri şunlardır.
                                        

CHECKBOX KONTROLÜNÜN OLAYLARI


CheckedChanged: CheckBox nesnesinin durumu değiştirildiğinde gerçekleşen olaydır.

Aşağıdaki örneği inceleyerek bu konuyu daha iyi anlayabilirsiniz...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CheckBox
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void chkKalin_CheckedChanged(object sender, EventArgs e)
        {
            textBox1.Font = new Font(textBox1.Font.Name, textBox1.Font.Size, textBox1.Font.Style ^ FontStyle.Bold);
        }

        private void chkEgik_CheckedChanged(object sender, EventArgs e)
        {
            textBox1.Font = new Font(textBox1.Font.Name, textBox1.Font.Size, textBox1.Font.Style ^ FontStyle.Italic);
        }

        private void chkAltiCizgili_CheckedChanged(object sender, EventArgs e)
        {
            textBox1.Font = new Font(textBox1.Font.Name, textBox1.Font.Size, textBox1.Font.Style ^ FontStyle.Underline);
        }
    }
}











Hiç yorum yok: