老猫の理想
迈克老猫
初始化文本框、按钮的效果函数。
注释很清楚我就不多说了。
程序代码: |
.btnadd_1 { font-size: 12px; width: 80px; height: 22px; background-image: url(Images/Btn/btnadd_1.gif); border: none; padding-top: 3px; cursor:hand; } .btnadd_2 { font-size: 12px; width: 80px; height: 22px; background-image: url(Images/Btn/btnadd_2.gif); border: none; padding-top: 3px; cursor:hand; } | |
程序代码: |
/// <summary> /// 控件效果 /// </summary> /// <param name="ctrls">控件数组,一种类型控件数组,目前只支持Button,TextBox两种类型控件,比如Control ctrls={btn_Add,Btn_Save}</param> /// <param name="Type1">样式类型1,Button控件,支持鼠标滑过onmouseOver和鼠标滑开两种效果,TextBox控件,支持鼠标获得焦点onFocus和失去焦点两种效果</param> /// <param name="Type2">样式类型2</param> public void CtrlAttributes(Control [] ctrls,string Type1,string Type2) { for (int i=0;i<ctrls.Length;i++) { if (ctrls[i] is TextBox) { ((TextBox)ctrls[i]).Attributes.Add("class",Type1); ((TextBox)ctrls[i]).Attributes.Add("onFocus","className='"+Type2+"'"); ((TextBox)ctrls[i]).Attributes.Add("onBlur","className='"+Type1+"'"); } if (ctrls[i] is Button) { ((Button)ctrls[i]).Attributes.Add("class",Type1); ((Button)ctrls[i]).Attributes.Add("onmouseOver","className='"+Type2+"'"); ((Button)ctrls[i]).Attributes.Add("onmouseOut","className='"+Type1+"'"); } } } | |
本文地址:http://com.8s8s.com/it/it44804.htm