资源简介
让Duilib完美支持gif,GDI+实现,支持文件或zip,资源加载。
代码片段和文件信息
#include “StdAfx.h“
namespace DuiLib {
CDialogBuilder::CDialogBuilder() : m_pCallback(NULL) m_pstrtype(NULL)
{
}
CControlUI* CDialogBuilder::Create(STRINGorID xml LPCTSTR type IDialogBuilderCallback* pCallback
CPaintManagerUI* pManager CControlUI* pParent)
{
//资源ID为0-65535,两个字节;字符串指针为4个字节
//字符串以<开头认为是xml字符串,否则认为是xml文件
if( HIWORD(xml.m_lpstr) != NULL ) {
if( *(xml.m_lpstr) == _T(‘<‘) ) {
if( !m_xml.Load(xml.m_lpstr) ) return NULL;
}
else {
if( !m_xml.LoadFromFile(xml.m_lpstr) ) return NULL;
}
}
else {
HRSRC hResource = ::FindResource(CPaintManagerUI::GetResourceDll() xml.m_lpstr type);
if( hResource == NULL ) return NULL;
HGLOBAL hGlobal = ::LoadResource(CPaintManagerUI::GetResourceDll() hResource);
if( hGlobal == NULL ) {
FreeResource(hResource);
return NULL;
}
m_pCallback = pCallback;
if( !m_xml.LoadFromMem((BYTE*)::LockResource(hGlobal) ::SizeofResource(CPaintManagerUI::GetResourceDll() hResource) )) return NULL;
::FreeResource(hResource);
m_pstrtype = type;
}
return Create(pCallback pManager pParent);
}
CControlUI* CDialogBuilder::Create(IDialogBuilderCallback* pCallback CPaintManagerUI* pManager CControlUI* pParent)
{
m_pCallback = pCallback;
CMarkupNode root = m_xml.GetRoot();
if( !root.IsValid() ) return NULL;
if( pManager ) {
LPCTSTR pstrClass = NULL;
int nAttributes = 0;
LPCTSTR pstrName = NULL;
LPCTSTR pstrValue = NULL;
LPTSTR pstr = NULL;
for( CMarkupNode node = root.GetChild() ; node.IsValid(); node = node.GetSibling() ) {
pstrClass = node.GetName();
if( _tcscmp(pstrClass _T(“Image“)) == 0 ) {
nAttributes = node.GetAttributeCount();
LPCTSTR pImageName = NULL;
LPCTSTR pImageResType = NULL;
DWORD mask = 0;
for( int i = 0; i < nAttributes; i++ ) {
pstrName = node.GetAttributeName(i);
pstrValue = node.GetAttributeValue(i);
if( _tcscmp(pstrName _T(“name“)) == 0 ) {
pImageName = pstrValue;
}
else if( _tcscmp(pstrName _T(“restype“)) == 0 ) {
pImageResType = pstrValue;
}
else if( _tcscmp(pstrName _T(“mask“)) == 0 ) {
if( *pstrValue == _T(‘#‘)) pstrValue = ::CharNext(pstrValue);
mask = _tcstoul(pstrValue &pstr 16);
}
}
if( pImageName ) pManager->AddImage(pImageName pImageResType mask);
}
else if( _tcscmp(pstrClass _T(“Font“)) == 0 ) {
nAttribute
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10901 2014-09-01 16:08 UIDefine.h
文件 21324 2014-09-01 16:07 UIDlgBuilder.cpp
文件 6347 2014-09-02 11:24 UIGifAnim.cpp
文件 797 2014-09-01 19:25 UIGifAnim.h
文件 3982 2014-09-01 16:07 UIlib.h
文件 92507 2014-09-02 11:45 UIRender.cpp
文件 2558 2014-09-02 11:27 UIRender.h
----------- --------- ---------- ----- ----
138416 7
- 上一篇:zigbee API接口函数
- 下一篇:Tiny6410底板原理图
相关资源
- duilib webkit内核浏览器控件
- 数码管字体
-
DUILIB加载xm
l界面源码 - 天气预报gif动图 带JS对应图标解析说
- Qt编写GIF录屏工具
- gif loading 透明背景
- GIF等待动图图标
- 61个等待中gif动态图片资源
- 2013 duilib入门简明教程 整个工程(含
- 1000张各种实用透明gif小图标素材
- 加载中gif图片-透明loading.rar
- 基于duilib的NSIS界面插件
- 4000个按钮小图标
- A Mathematical Gift
- 冒险岛怪物GIF图 游戏素材
- A Mathematical Gift 2
- A Mathematical Gift 1
- gif动态彩图转化黑白动画简单图形识
- 64位Duilib库lib+dll
- 164个loading图片gif格式-透明背景
- 164个加载中gif图片loading动态图片
- 截长图,截gif动图软件,Windows最轻好
- gif透明背景loading图片大全
- duilib入门简明教程 chm
- duilib VS2013编译好的库
- Duilib做的登录窗口
- duilib界面库,库ListCtrl可以添加check
- RichEditDemo(DuiLib版)
- 异形窗口与gif动画带透明背景的实现
- 支持上百种格式打开工具FileViewProc 免
评论
共有 条评论