C# 更改按钮的背景颜色 [英] C# Change A Button's Background Color
本文介绍了C# 更改按钮的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按下另一个按钮后,按钮的背景颜色如何?
How can the background color of a button once another button is pressed?
我目前拥有的是:
ButtonToday.Background = Color.Red;
它不起作用.
推荐答案
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;
}
这篇关于C# 更改按钮的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文