C# Change A Button's Background Color

前端 未结 7 981
独厮守ぢ
独厮守ぢ 2020-12-01 14:04

How can the background color of a button once another button is pressed?

What I have at the moment is:

ButtonToday.Background = Color.Red;
         


        
7条回答
  •  不知归路
    2020-12-01 14:33

    WinForm:

    private void button1_Click(object sender, EventArgs e)
    {
       button2.BackColor = Color.Red;
    }
    

    WPF:

    private void button1_Click(object sender, RoutedEventArgs e)
    {
       button2.Background = Brushes.Blue;
    }
    

提交回复
热议问题