简体   繁体   English

如何在一系列点击后让按钮返回到其原始状态

[英]How to get buttons to return back to its original state after a series of clicks

I am making a web application where the user will click on a number of different buttons, the border of these buttons will then change color, however whenever the user clicks on the enter button I want the buttons that were previously clicked to change back to their original state. 我正在创建一个Web应用程序,用户将点击许多不同的按钮,然后这些按钮的边框将改变颜色,但是每当用户点击输入按钮时,我希望之前单击的按钮更改回他们的原始状态。

Any help is appreciated 任何帮助表示赞赏

protected void btnTeam1_Click(object sender, EventArgs e) { 
    btnTeam1.BorderColor = System.Drawing.Color.Yellow; 
    lblMessage2.Text = "Home Team"; 
} 
protected void btnTeam2_Click(object sender, EventArgs e) { 
    lblMessage2.Text = "Away Team"; 
    btnTeam2.BorderColor = System.Drawing.Color.Yellow; 
} 

The user then goes and clicks an enter button which inputs data into a DB. 然后用户转到并单击输入按钮,该按钮将数据输入到DB中。 Whenever the enter button is clicked I would like the buttons that have been clicked to have no yellow border 每当点击输入按钮时,我希望点击的按钮没有黄色边框

Add these lines to the Click function for your enter button: 将这些行添加到enter按钮的Click函数中:

btnTeam1.BorderColor = System.Drawing.Color.Empty;
btnTeam2.BorderColor = System.Drawing.Color.Empty; 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 登录后如何让用户回到原来的页面? - How to return user back to the original page after login? 如何将原始二进制值恢复为字符串 - How to get the original binary value back to string 将 Window 脱钩到原来的 State - Unhook Window into its original State 我试图在单击时更改按钮的前景色,再次单击时它将恢复为原始颜色 - I am trying to make a buttons forecolor change when clicked and when it is clicked again it will revert back to its original color 实体框架5 - 为什么在PropertyValue设置回原始状态后实体状态为“已修改” - Entity Framework 5 - Why is Entity State “Modified” after PropertyValue is set back to Original 在C#中更改文本框的Text属性后,WPF将绑定动态设置回原始状态 - WPF set Binding dynamically back to original state after changing Text property of textbox in C# 在杀死TabletKeyboard(TabTip.exe)应用程序的过程后,在wpf中没有恢复到原来的大小 - After killing the process for TabletKeyboard(TabTip.exe) application doesn't bring back to its original size in wpf Cookie请求后如何将瑞典字母设置为原始状态 - How to set Swedish letters to their original state after a cookie request 统一旋转后如何将对象恢复到其原始位置? - How to bringback an object to its original position after rotation in unity? 更改内容并单击后返回原始状态的按钮 - Button to change content and back to original state on click of it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM