如何避免按钮更改其属性文件事件发生 [英] How Can I Avoid Button To Change Its Property Wen Event Occurs
本文介绍了如何避免按钮更改其属性文件事件发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按钮单击发生时按钮背面颜色更改
when a button click occurs button backcolor changes
protected void RadioButtonList2_SelectedIndexChanged(object sender, EventArgs e)
{
Button2.BackColor = System.Drawing.Color.YellowGreen;
}
i想要避免按钮颜色的变化再次发生
plz提供needfull
i Want to avoid the change of color of button if again it happens
plz provide the needfull
推荐答案
查看此链接
http://www.c-sharpcorner.com/Forums/Thread/187702/__cs_myImageUpload.aspx [ ^ ]
这方法会将所有控件的背景颜色重置为默认值。因此,无论你想要什么,都可以调用此方法。
This method will reset all the control's backcolor to its default one. So invoke this method wherever you want.
// Reset all the controls to the user's default Control color.
private void ResetAllControlsBackColor(Control control)
{
control.BackColor = SystemColors.Control;
control.ForeColor = SystemColors.ControlText;
if(control.HasChildren)
{
// Recursively call this method for each child control.
foreach(Control childControl in control.Controls)
{
ResetAllControlsBackColor(childControl);
}
}
}
src : msdn[^]
-KR
这篇关于如何避免按钮更改其属性文件事件发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文