www.muilib.com MUILIB能够原生支持Alpha透明绘制的层窗口技术,所以很轻松就能创建不规则窗口和不规则控件(非矩形),
请看效果图:
要实现如图所示的窗口和8个按钮,不需编写任何代码,只需做如下配置即可实现。
XML配置代码
1 <?xml version="1.0" encoding="UTF-8"?>
2 <muiapp>
3 <Resources>
4 <Images>
5 <Image name="bk" file="images\bk.png" />
6 <Image name="00" file="images\00.png" painttype="xycenter" />
7 <Image name="11" file="images\11.png" painttype="xycenter" />
8 <Image name="12" file="images\12.png" painttype="xycenter" />
9 <Image name="21" file="images\21.png" painttype="xycenter" />
10 <Image name="22" file="images\22.png" painttype="xycenter" />
11 <Image name="31" file="images\31.png" painttype="xycenter" />
12 <Image name="32" file="images\32.png" painttype="xycenter" />
13 <Image name="41" file="images\41.png" painttype="xycenter" />
14 <Image name="42" file="images\42.png" painttype="xycenter" />
15 <Image name="51" file="images\51.png" painttype="xycenter" />
16 <Image name="52" file="images\52.png" painttype="xycenter" />
17 <Image name="61" file="images\61.png" painttype="xycenter" />
18 <Image name="62" file="images\62.png" painttype="xycenter" />
19 <Image name="71" file="images\71.png" painttype="xycenter" />
20 <Image name="72" file="images\72.png" painttype="xycenter" />
21 <Image name="81" file="images\81.png" painttype="xycenter" />
22 <Image name="82" file="images\82.png" painttype="xycenter" />
23 </Images>
24 </Resources>
25 <Window size="311,314" caption="0,0,0,-1" backalpha="200">
26 <VertiPanel margin="5,5,5,5" childpadding="5" bkimage="@00">
27 <Button hotimage="@12" hitmask="true" hitmaskmap="@11" float="true" pos="102,12,210,72" />
28 <Button hotimage="@22" hitmask="true" hitmaskmap="@21" float="true" pos="191,22,289,119" />
29 <Button hotimage="@32" hitmask="true" hitmaskmap="@31" float="true" pos="238,100,298,208" />
30 <Button hotimage="@42" hitmask="true" hitmaskmap="@41" float="true" pos="192,189,290,287" />
31 <Button hotimage="@52" hitmask="true" hitmaskmap="@51" float="true" pos="102,238,211,298" />
32 <Button hotimage="@62" hitmask="true" hitmaskmap="@61" float="true" pos="24,188,121,286" />
33 <Button hotimage="@72" hitmask="true" hitmaskmap="@71" float="true" pos="14,100,74,208" />
34 <Button hotimage="@82" hitmask="true" hitmaskmap="@81" float="true" pos="24,24,121,121" />
35 </VertiPanel>
36 </Window>
37 </muiapp>
要想实际查看运行效果,请到MUILIB官方网站下载最新版的MUIPlayer
www.muilib.com
本演示文件的资源下载地址:
不规则窗口和按钮演示资源
下载上面的资源包解压缩到一个目录里,使用muiplayer打开里面的mui文件,即可看到运行效果
特点:
1、鼠标在透明区域不激活任何按钮控件
2、鼠标在透明区域窗口无法选择和移动
3、圆形中间白色透明部分是为了可以拖动窗口而设置