html修改按钮背景颜色,html鼠标悬浮在按钮上,让按钮背景变色
我寫了個例子給你,不肯定是不是你要實現的效果哈。(基于c#)
前端代碼:
Grid
StackPanel
Button Background=Blue Name=btn Width=100 Height=100 Click=btn_Click/Button
TextBlock Name=txt Text=null HorizontalAlignment=Center/
/StackPanel
/Grid
后臺代碼
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;
}
}
}
取消
評論
總結
以上是生活随笔為你收集整理的html修改按钮背景颜色,html鼠标悬浮在按钮上,让按钮背景变色的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: html 桌面截图,如何使用javasc
 - 下一篇: 在Java生成的html页面加水印,Ja