Oct 12, 2015

C# Basic ] Checkbox




I changed Radio button to check box.


You can see new layout.



Radio button -> check.

Source code is simple

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if(checkBox1.Checked==true)
            {
                timermode = false;
            }
            else
            {
                timermode = true;
            }
            timer_init();
         }

If you checked 'check box' call 'checkBox1_CheckedChanged'

Count mode as 'Checked' is true, Timer mode as 'Checked' is false.

This is protection check box.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
            textBox1.Text = "테스트를 시작합니다.";
            checkBox1.Enabled = false;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Stop();
            textBox1.Text = "테스트를 종료합니다.";
            checkBox1.Enabled = true;
            timer_init();
        }

Line 5 : deactivate check box.

Line 11 : activate check box.

No comments:

Post a Comment