Denuo DirectUI XML配置文件解读
2013-04-15 17:38
246 查看
Denuo DirectUI 支持完全的XML文件解析,完全的XML解析指的是Denuo DirectUII的所有资源支持XML配置文件解析,后面会一一的解读。
1、为什么采用XML文件。
采用UI库的目的是解放编程,通常资源的调用大体需要这样
我们采用统一加载资源文件对资源进行管理,这样做的好处或者目的有两个,
第一、统一管理资源,方便加载、调用与释放,避免内存泄漏。
第二、重复使用资源,提高效率与内存的使用率。
刚才只是讲到了XML对于资源的配置与使用,在本系统中所有的控件的加载与布局等等都是通过XML配置完成,这样做的方便与易用之处可以通过使用我们的库感觉到。
刚才提到了,采用UI库的目的是解放编程,同时我们要做到易于编辑,采用XML配置文件,你可以方便的编辑你的配置。
2、XML配置文件的使用。
下面以一个IM登录界面的配置文件为例。
控件的配置文件
下一节将会详细接受XML配置文件的节点。
敬请关注www.denuosoft.net
1、为什么采用XML文件。
采用UI库的目的是解放编程,通常资源的调用大体需要这样
HBITMAP hBitmap = ::LoadBitmap(IDB_BITMAP_IMAGE) ... ::BitBlt(hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, dwRop); ... //最后不要忘记 ::DeleteObject(m_hBitmap);每次使用都需要加载文件释放文件,影响了整体效率。也有人说了,我们可以对资源文件进行封装,使用的时候再调用,这样当然可以,使用环境相对简单的情况下可以这样,如果使用环境复杂后,代码量会加倍增加。
我们采用统一加载资源文件对资源进行管理,这样做的好处或者目的有两个,
第一、统一管理资源,方便加载、调用与释放,避免内存泄漏。
第二、重复使用资源,提高效率与内存的使用率。
刚才只是讲到了XML对于资源的配置与使用,在本系统中所有的控件的加载与布局等等都是通过XML配置完成,这样做的方便与易用之处可以通过使用我们的库感觉到。
刚才提到了,采用UI库的目的是解放编程,同时我们要做到易于编辑,采用XML配置文件,你可以方便的编辑你的配置。
2、XML配置文件的使用。
下面以一个IM登录界面的配置文件为例。
<DirectUI> <Skin> <Images> <Image Name="SysImageCloseNormal" RdbFile="" RdbPos="" ImageFile=".\close.png"/> </Images> <Fonts> <Font Name="SysFont" Height="9" Weight="400" Italic="False" Underline="False" Strikeout="False" Family="宋体"/> </Fonts> <Cursors/> <Layouts> <Layout Name="SysLayoutClose" Style="Parent" HorzAlign="AlignRight" HorzSpace="HFastness" VertAlign="AlignTop" VertSpace="VFastness" Left="0" HCenter="0" Right="0" Width="39" Top="0" VCenter="0" Bottom="0" Height="20"/> </Layouts> <Styles> <Style Name="SysStyleClose"> <Image State="Down" ImageName="SysImageCloseDown" LeftPart="0" TopPart="0" RightPart="0" BottomPart="0" PaintMode="Copy" CopyAlign="AlignCenter" Alpha="False"/> <Image State="Hover" ImageName="SysImageCloseHover" LeftPart="0" TopPart="0" RightPart="0" BottomPart="0" PaintMode="Copy" CopyAlign="AlignCenter" Alpha="False"/> <Image State="Normal" ImageName="SysImageCloseNormal" LeftPart="0" TopPart="0" RightPart="0" BottomPart="0" PaintMode="Copy" CopyAlign="AlignCenter" Alpha="False"/> </Style> </Styles> </Skin> </DirectUI>
控件的配置文件
<DirectUI> <DirectUIWindow> <DirectUIControl PaintStyle="" Layout="SysLayoutFrame" ID="100" Name="" Text="DirectUIControl_100" Rect="0,0,588,580" TableStop="False"> <DirectUIControl PaintStyle="SysStyleUp" Layout="SysLayoutBkgUp" ID="100" Name="DirectUIControl_100" Text="" Rect="0,0,588,254" TableStop="False"> <DirectUIControl PaintStyle="SysStyleLogo" Layout="SysLayoutLogo" ID="100" Name="DirectUIControl_100" Text="" Rect="217,60,371,170" TableStop="False"/> <DirectUIButton PaintStyle="SysStyleClose" Layout="SysLayoutClose" ID="100" Name="DirectUIButton_100" Text="" Rect="549,0,588,20" TableStop="False"/> <DirectUIButton PaintStyle="SysStyleMax" Layout="SysLayoutMax" ID="101" Name="DirectUIButton_101" Text="" Rect="521,0,549,20" TableStop="False"/> <DirectUIButton PaintStyle="SysStyleMin" Layout="SysLayoutMin" ID="102" Name="DirectUIButton_102" Text="" Rect="493,0,521,20" TableStop="False"/> </DirectUIControl> <DirectUIControl PaintStyle="SysStyleMid" Layout="SysLayoutMid" ID="100" Name="DirectUIControl_100" Text="12" Rect="0,254,588,612" TableStop="False"> <DirectUIEdit FgStyle="" BkgStyle="SysStyleFrameBorder" Font="" PaintStyle="" Layout="SysLayoutUser" ID="100" Name="DirectUIEdit_100" Text="" Rect="192,284,396,310" TableStop="False"/> <DirectUIEdit FgStyle="" BkgStyle="SysStyleFrameBorder" Font="" PaintStyle="" Layout="SysLayoutPwd" ID="100" Name="DirectUIEdit_100" Text="" Rect="192,340,396,366" TableStop="False"/> <DirectUIButton PaintStyle="SysStyleLogin" Layout="SysLayoutLogin" ID="100" Name="DirectUIButton_100" Text="登录" Rect="247,502,342,532" TableStop="False"/> <DirectUICheckBox CheckedStyle="SysStyleCheckBoxCheck" UnCheckedStyle="SysStyleCheckBoxUncheck" HalfCheckedStyle="" BoxWidth="16" CheckState="UnChecked" PaintStyle="" Layout="SysLayoutRemember" ID="100" Name="DirectUICheckBox_100" Text="记住密码" Rect="192,399,292,419" TableStop="False"/> <DirectUICheckBox CheckedStyle="SysStyleCheckBoxCheck" UnCheckedStyle="SysStyleCheckBoxUncheck" HalfCheckedStyle="" BoxWidth="16" CheckState="Checked" PaintStyle="" Layout="SysLayoutAuto" ID="100" Name="DirectUICheckBox_100" Text="自动登录" Rect="192,422,292,442" TableStop="False"/> <DirectUIButton IcoImage="SysToolStatusOnlineImg" ImageAlignType="AlignCenter" PaintStyle="SysStyleToolBtn" Layout="SysLayoutState" ID="100" Name="DirectUIButton_100" Text="" Rect="224,376,244,396" TableStop="False"/> <DirectUIRadioBox CheckedStyle="SysStyleRaidoCheck" UnCheckedStyle="SysStyleRaidoUnCheck" BoxWidth="16" CheckState="UnChecked" PaintStyle="" Layout="SysLayoutRadio1" ID="100" Name="DirectUIRadioBox_100" Text="Radio测试1" Rect="192,444,292,464" TableStop="False"/> <DirectUIRadioBox CheckedStyle="SysStyleRaidoCheck" UnCheckedStyle="SysStyleRaidoUnCheck" BoxWidth="16" CheckState="Checked" PaintStyle="" Layout="SysLayoutRadio2" ID="101" Name="DirectUIRadioBox_101" Text="Radio测试2" Rect="192,464,292,484" TableStop="False"/> </DirectUIControl> <DirectUIControl PaintStyle="SysStyleDown" Layout="SysLayoutDown" ID="100" Name="DirectUIControl_100" Text="" Rect="0,612,588,580" TableStop="False"/> </DirectUIControl> </DirectUIWindow> </DirectUI>
下一节将会详细接受XML配置文件的节点。
敬请关注www.denuosoft.net
相关文章推荐
- Denuo DirectUI XML配置文件的节点
- web.xml配置文件解读
- struts2学习--解读struts.xml配置文件和值栈的学习
- WEB.xml配置文件解读
- web.xml配置文件详细解读
- 解读WEB工程下的web.xml配置文件
- Maven配置文件pom.xml详细解读
- 初学springMVC -servlet.xml之配置文件解读。
- 在Web.xml中自动扫描Spring的配置文件及resource时classpath*:与classpath:的区别
- 使用common-configuration进行对配置文件的操作(xml,properties)
- Maven之(七)pom.xml配置文件详解
- Hadoop 2.2.0配置文件:hdfs-default.xml
- mybatis学习总结-核心配置文件mybatis-config.xml(二)
- 使用 PHP 处理 XML 配置文件
- tomcat配置文件server.xml详解
- UWSGI配置文件---ini和xml示例
- 修改Struts2的struts.xml配置文件位置
- struts-config.xml配置文件详解
- Eclipse 自动生成 Ant的Build.xml 配置文件
- AJAX实现手动配置的xml文件读取