我写了个例子给你,不肯定是不是你要实现的效果哈。(基于c#)
前端代码:
后台代码
public partial class Page1 : Page
{
public Page1()
{
InitializeComponent();
}
string tag=string.Empty;
private void btn_Click(object sender, RoutedEventArgs e)
{
Button btn = sender as Button;
if (tag == string.Empty)
{
btn.Background = new SolidColorBrush(Colors.Red);
txt.Text = "0";
tag = "0";
}
else
{
btn.Background = new SolidColorBrush(Colors.Blue);
txt.Text = "null";
tag = string.Empty;
}
}
}