skin.xml皮肤配置讲解

今天完成了影片上传审核和添加的功能,轻松一下,来讲讲GUI GDI版本的皮肤配置。

想要直接使用的朋友不要错过哦。

先来总体看一下xml的结构:

 

<root>
    
<tip></tip>
    
<messagebox></messagebox>
    
<menu></menu>
    
<window></window>
</root>

 

基本的结构如上,所有配置都在xml的root根节点中,紧跟着是一些固定配置项:

1.tip节点是配置tip窗口的,通过tip节点可以自己指定tip窗口的样式,可以和window窗口一样设置图片背景等。

例如可以这样用九宫格的方式设置背景:

    <tip name="tip" width="100" height="30" bgmode="nine" resize="0" caption="0" bgbmp="tiptl.bmp,tiptm.bmp,tiptr.bmp,tiplm.bmp,tipbg.bmp,tiprm.bmp,tipbl.bmp,tipbm.bmp,tipbr.bmp">
    
</tip>

 

2.messagebox节点是配置通用消息对话框的,这个配置可以按照自己的需要定制漂亮的消息对话框。配置的内容有固定要求,比如里面的按钮必须都要有。使用的时候只需要拷贝一份我给的示例修改相应需要修改的地方就可以了,范例如下:

 

<messagebox name="messagebox" width="350" height="200" minwidth="350" minheight="200" bgmode="nine" resize="0" bgbmp="wndtl.bmp,wndtm.bmp,wndtr.bmp,wndlm.bmp,wndbg.bmp,wndrm.bmp,wndbl.bmp,wndbm.bmp,wndbr.bmp" fontcolor="#003564">
        
<button name="yes" anchor="LBLB" pos="10,32,60,10" bgmode="one" bgbmp="btn.png" visible="1" text="ST:1"></button>
        
<button name="no" anchor="LBLB" pos="70,32,120,10" bgmode="one" bgbmp="btn.png" visible="1" text="ST:2"></button>
        
<button name="cancel" anchor="LBLB" pos="130,32,80,10" bgmode="one" bgbmp="btn.png" visible="1" text="ST:3"></button>
        
<button name="abort" anchor="LBLB" pos="190,32,240,10" bgmode="one" bgbmp="btn.png" visible="1" text="ST:4"></button>
        
<button name="retry" anchor="LBLB" pos="250,32,300,10" bgmode="one" bgbmp="btn.png" visible="1" text="ST:5"></button>
        
<button name="continue" anchor="LBLB" pos="310,32,360,10" bgmode="one" bgbmp="btn.png" visible="1" text="ST:6"></button>
        
<button name="ignore" anchor="LBLB" pos="250,32,300,10" bgmode="one" bgbmp="btn.png" visible="1" text="ST:7"></button>
        
<button name="ok" anchor="LBLB" pos="310,32,360,10" bgmode="one" bgbmp="btn.png" visible="1" text="OK"></button>
    
</messagebox>

 

 需要注意一点,为了方便多语言版切换语言,按钮的文字配置使用的是stringtable的索引,text="ST:7"这里直接使用的就是stringTable的索引号。

3.menu节点可以有多个,表示多个菜单项。(上面的tip和messagebox都是单一实例的)

menu的item项由menuitem 来配置,目前菜单没有做动态插入item的功能,主要是目前我做的项目没遇到,也就没做这些动态创建控件的功能,不过在我现有代码的基础上修改下应该是可以的,需要看广大朋友的了。放出一个menu的配置范例(系统tray的菜单):

 

<menu name="menutray" width="140" height="86" bgmode="nine" resize="0" caption="0" bgbmp="menutl.bmp,menutm.bmp,menutr.bmp,menulm.bmp,menubg.bmp,menurm.bmp,menubl.bmp,menubm.bmp,menubr.bmp"  fontname="宋体"  fontcolor="#003564">
        
<menuitem name="open" text="ST:72"></menuitem>
        
<menuitem name="start" text="ST:73"></menuitem>
        
<menuitem name="stop" text="ST:74"></menuitem>
        
<menuitem name="quit" text="ST:75"></menuitem>
    
</menu>

 

 4.window节点就是我们程序中的各种窗口了。这块后面会详细介绍,这里先放出一个登录窗的范例:

<!--登录窗-->
    
<window name="UMFCLoginWindow" fontname="Verdana" resize="0" width="300" height="220"  fontcolor="#003564" bgmode="nine">
        
<button name="sys_close" hsl="0" anchor="RTRT" pos="48,0,0,21" bgmode="one" bgbmp="btn_close.png"></button>
        
<button name="sys_min" hsl="0" anchor="RTRT" pos="76,0,48,21" bgmode="one" bgbmp="btn_min.png"></button>
        
<static anchor="LTLT" pos="20,55,80,70" text="ST:22"></static>
        
<editor    name="editusr" anchor="LTRT" pos="75,50,25,72" line="single" fontsize="10" bgcolor="#e7fefd" borderclr="#8ebbff" borderclrh="#aeceff" tab="1"></editor>
        
<static anchor="LTLT" pos="20,95,80,110" text="ST:23"></static>
        
<editor    name="editpwd" anchor="LTRT" pos="75,90,25,112" line="single" fontsize="10" password="1" bgcolor="#e7fefd" borderclr="#8ebbff" borderclrh="#aeceff" tab="2"></editor>
        
<button name="btnlogin" anchor="LTLT" pos="40,150,140,182" bgmode="one" bgbmp="bigbtn.png" text="ST:24"></button>
        
<button name="btncancel" anchor="LTLT" pos="160,150,260,182" bgmode="one" bgbmp="bigbtn.png" text="ST:25"></button>

    </window>  

 今天先写到这里,下篇我想讲下xml配置有那些标签和attributes,敬请期待 HOHO~~~

posted @ 2011-05-28 16:24  健忘猪  阅读(1660)  评论(0编辑  收藏  举报