namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { radioButton1.Enabled = false; radioButton2.Enabled = false; radioButton3.Enabled = false; } private void buttonChangeText_Click(object sender, EventArgs e) { this.Text = textBox1.Text+" Welcome!!"; /*เปลี่ยนข้อความ title bar ด้านบน*/ } private void buttonChangeBgColor_Click(object sender, EventArgs e) { radioButton1.Enabled = true; radioButton2.Enabled = true; radioButton3.Enabled = true; } private void radioButton1_CheckedChanged(object sender, EventArgs e) { this.BackColor = Color.White; this.Text = "The BG color of form is " + this.BackColor.ToString(); } private void radioButton2_CheckedChanged(object sender, EventArgs e) { this.BackColor = Color.GreenYellow; this.Text = "The BG color of form is " + this.BackColor.ToString(); } private void radioButton3_CheckedChanged(object sender, EventArgs e) { this.BackColor = Color.Gray; this.Text = this.BackColor.ToString(); } private void buttonEnd_Click(object sender, EventArgs e) { this.Close(); } } }
this คือ Form นี้
radioButton1.Enabled = false; คือ disable ให้กดไม่ได้
CheckedChanged คือเมื่อเปลี่ยนกดเช็คให้ทำตามนั้น
Sign up here with your email
ConversionConversion EmoticonEmoticon