MUILIB支持多种模式的按钮:
1、支持纯颜色状态
2、支持带状态的图标
3、支持按钮文字的状态颜色
4、支持多模式按钮状态图片
5、支持按钮图标和文字混合显示
6、支持按钮规定宽度和自适应宽度
![](/Images/OutliningIndicators/ContractedBlock.gif)
XML配置代码
<?xml version="1.0" encoding="UTF-8"?>
<muiapp>
<Resources>
<Images>
<Image name="btn" file="images\btn.bmp" painttype="xycenter">
<Image name="nor" source="0,0,22,22" />
<Image name="hot" painttype="stretch9" margin="2,2,2,2" source="22,0,44,22" />
<Image name="pus" painttype="stretch9" margin="2,2,2,2" source="44,0,66,22" />
</Image>
<Image name="btn_clr" file="images\btn_clr.bmp">
<Image name="nor" source="0,0,75,26" />
<Image name="hot" source="75,0,150,26" />
<Image name="pus" source="150,0,225,26" />
</Image>
<Image name="btn_all" file="images\btn_all.bmp" mask="#FFFF00FF" painttype="xycenter">
<Image name="nor" mask="#FFFF00FF" painttype="stretch9" margin="2,2,2,2" source="0,0,69,21" />
<Image name="hot" mask="#FFFF00FF" painttype="stretch9" margin="2,2,2,2" source="0,21,69,42" />
<Image name="pus" mask="#FFFF00FF" painttype="stretch9" margin="2,2,2,2" source="0,42,69,63" />
<Image name="foc" mask="#FFFF00FF" painttype="stretch9" margin="6,6,6,6" source="0,63,69,84" />
<Image name="dis" mask="#FFFF00FF" painttype="stretch9" margin="3,3,3,3" source="0,84,69,105" />
</Image>
<Image name="back" file="images\back.png" painttype="stretch9" marginalpha="126" outsidemargin="10,10,10,10" margin="6,6,6,6" />
<Image name="icon" file="images\icon_color.png" painttype="xycenter" />
</Images>
<Colors>
<Palette id="1" name="11">
<Color id="2" name="nor" value="#FFC0C0C0" />
<Color id="2" name="hot" value="#FFE0E0E0" />
<Color id="2" name="pus" value="#FF808080" />
<Color id="2" name="pus_1" value="#FFA0A0A0" />
<Color id="2" name="foc" value="#FFE5E8E0" />
</Palette>
</Colors>
</Resources>
<Window size="400,260" caption="0,0,0,-1" showdirty="false" backalpha="250" bkcolor="#00000000" bkimage="@back">
<VertiPanel margin="20,20,20,20" childpadding="5">
<VertiPanel bordersize="1,1,1,1">
<HorizPanel bordersize="1,1,1,1" height="26">
<Label textpadding="5,0,0,0" text="纯颜色按钮 - 按钮状态使用颜色表示,同时演示了按钮宽度" mouse="false" />
</HorizPanel>
<HorizPanel margin="5,5,5,5" childpadding="5">
<Button normalcolor="#FFC0C0C0" hotcolor="#FFE0E0E0" pushedcolor="#FFA0A0A0" focusedcolor="#FFE5E8E0" textpadding="5,0,5,0" text="按钮一" bordersize="1,1,1,1" tooltiptext="自适应按钮文本宽度" />
<Button normalcolor="#FFC0C0C0" hotcolor="#FFE0E0E0" pushedcolor="#FFA0A0A0" focusedcolor="#FFE5E8E0" textpadding="5,0,5,0" text="按钮2" bordersize="1,1,1,1" tooltiptext="自适应按钮文本宽度" />
<Button normalcolor="#FFC0C0C0" hotcolor="#FFE0E0E0" pushedcolor="#FFA0A0A0" focusedcolor="#FFE5E8E0" hottextcolor="#FF0000FF" pushedtextcolor="#FF00FF00" text="固定宽度" bordersize="1,1,1,1" width="100" tooltiptext="按钮宽度为设定的宽度" />
<Button disabledcolor="#FF808080" enabled="false" text="全宽度按钮-不可用" bordersize="1,1,1,1" estimatewidth="false" tooltiptext="按钮宽度为父容器剩余宽度" />
</HorizPanel>
</VertiPanel>
<VertiPanel bordersize="1,1,1,1">
<HorizPanel bordersize="1,1,1,1" height="26">
<Label text="图片按钮 - 按钮状态使用图片进行表示" mouse="false" />
</HorizPanel>
<HorizPanel margin="5,5,5,5" childpadding="5">
<Button normalimage="@btn_clr:nor" hotimage="@btn_clr:hot" pushedimage="@btn_clr:pus" text="按钮一" width="100" />
<Button normalimage="@btn_all:nor" hotimage="@btn_all:hot" pushedimage="@btn_all:pus" focusedimage="@btn_all:foc" disabledimage="@btn_all:dis" normalicon="@icon" textmodel="right" text="按钮二" width="120" />
<Button normalimage="@btn_all:nor" hotimage="@btn_all:hot" pushedimage="@btn_all:pus" focusedimage="@btn_all:foc" disabledimage="@btn_all:dis" enabled="false" text="按钮三-不可用" width="120" />
</HorizPanel>
</VertiPanel>
<VertiPanel bordersize="1,1,1,1">
<HorizPanel bordersize="1,1,1,1" height="26">
<Label text="图标按钮 - 按钮带有图标,按钮状态使用图片进行表示" mouse="false" />
</HorizPanel>
<HorizPanel margin="5,5,5,5" childpadding="5">
<Button normalimage="@btn:nor" hotimage="@btn:hot" pushedimage="@btn:pus" normalicon="@icon" iconwidth="20" iconheight="20" width="60" />
<Button normalimage="@btn:nor" hotimage="@btn:hot" pushedimage="@btn:pus" normalicon="@icon" iconwidth="26" iconheight="20" iconpadding="4,2,2,2" showtext="true" textmodel="right" align="left" text="按钮二" width="80" />
<Button hotimage="@btn:hot" pushedimage="@btn:pus" hottextcolor="#FFFFBBBD" pushedtextcolor="#FF96FF99" enabled="true" text="按钮三" estimatewidth="false" />
</HorizPanel>
</VertiPanel>
</VertiPanel>
</Window>
</muiapp>
点击下载上图所示的演示资源下载资源后解压缩至目录,请使用MUIPlayer打开其中的mui文件
muiplayer可以在
www.muilib.com下载