|
想要点按钮改变颜色的代码,水平问题看不懂,可以帮搞个通用的吗?
如上图,工作表sheet1中有三个形状工具画的按钮,默认设置成白底蓝框,蓝字;每个按钮点一下变成蓝底,白字,其他的白底蓝框,蓝字
- //遍历所有图形,并根据文本变换颜色
- for (let shp of Sheets("首页").Shapes){
- if (shp.Name.indexOf("bt_type")>=0){
- shp.TextFrame.Characters().Text=nameList[n++];
- if (nameList[n-1]==selectedName){
- shp.Fill.ForeColor.RGB=RGB(113,207,201);
- shp.TextFrame.Characters().Font.Color=RGB(255,255,255);
- }else{
- shp.Fill.ForeColor.RGB=RGB(255,255,255);
- shp.TextFrame.Characters().Font.Color=RGB(113,207,201);
- }
- if (nameList[n-1]==null){
- shp.Visible=false;
- }else{
- shp.Visible=true;
- }
- }
- }
复制代码
|
|