我是 C# 的初学者,我有一个家庭作业。在表单中,我有一个带有 5 个单选按钮和数字向上/向下数天的组合框。当我更改数字时。up-down,backcolor 应该改变它之前选择的颜色。我只能使用开关盒。我管理了数字。上下,标签随之变化。但是我不能插入开关盒来改变颜色。实际上我不能命名开关。
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "Pazartesi";
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
byte sayi = Convert.ToByte(numericUpDown1.Value);
switch (sayi)
{
case 1:
label1.Text="Pazartesi";
switch ( )
{
case renkbtn_1.Checked:
this.BackColor = Color.Red;
break;
case renkbtn_2.Checked:
this.BackColor = Color.White;
break;
case renkbtn_3.Checked:
this.BackColor = Color.Yellow;
break;
case renkbtn_4.Checked:
this.BackColor = Color.Blue;
break;
case renkbtn_5.Checked:
this.BackColor = Color.Green;
break;
}
break;
case 2:
label1.Text="Salı";
break;
case 3:
label1.Text = "Çarşamba";
break;
case 4:
label1.Text = "Perşembe";
break;
case 5:
label1.Text = "Cuma";
break;
case 6:
label1.Text = "Cumartesi";
break;
case 7:
label1.Text = "Pazar";
break;