├── .gitattributes ├── CTrayIcon ├── TrayIcon.cpp └── TrayIcon.h ├── MFC_Duilib_WND ├── MFCDuilibTest.sln ├── MFCDuilibTest │ ├── MFCDuilibTest.aps │ ├── MFCDuilibTest.cpp │ ├── MFCDuilibTest.h │ ├── MFCDuilibTest.rc │ ├── MFCDuilibTest.vcproj │ ├── MFCDuilibTestDlg.cpp │ ├── MFCDuilibTestDlg.h │ ├── MainWnd.cpp │ ├── MainWnd.h │ ├── ReadMe.txt │ ├── res │ │ ├── MFCDuilibTest.ico │ │ └── MFCDuilibTest.rc2 │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── README.md └── Skin │ ├── MainWnd.xml │ └── images │ ├── bkimage.png │ ├── btn_hot.png │ └── btn_normal.png ├── README.md ├── UIChildLayout ├── UIChildLayout.cpp ├── UIChildLayout.h └── xml.xml ├── UIColorPalette ├── UIColorPalette.cpp ├── UIColorPalette.h ├── snatshot.png └── xml.xml ├── UIDateTime ├── UIDateTime.cpp ├── UIDateTime.h ├── snatshot.png └── xml.xml ├── UIElipsePhoto ├── UIElipsePhoto.cpp ├── UIElipsePhoto.h └── snatshot.png ├── UIFadeButton ├── UIAnimation.cpp ├── UIAnimation.h ├── UIFadeButton.cpp ├── UIFadeButton.h └── snatshot.png ├── UIHotKey ├── UIHotKey.cpp ├── UIHotKey.h ├── snatshot.png └── xml.xml ├── UIIPAddress ├── UIIPAddress.cpp ├── UIIPAddress.h ├── snatshot.png └── xml.xml └── UITimeButton ├── UITimeButton.cpp ├── UITimeButton.h ├── snatshot.png └── xml.xml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /CTrayIcon/TrayIcon.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "TrayIcon.h" 3 | 4 | namespace DuiLib 5 | { 6 | CTrayIcon::CTrayIcon(void) 7 | { 8 | memset(&m_trayData, 0, sizeof(m_trayData)); 9 | m_bEnabled = false; 10 | m_bVisible = false; 11 | m_hWnd = NULL; 12 | m_uMessage = UIMSG_TRAYICON; 13 | } 14 | 15 | CTrayIcon::~CTrayIcon(void) 16 | { 17 | DeleteTrayIcon(); 18 | } 19 | 20 | void CTrayIcon::CreateTrayIcon( HWND _RecvHwnd, UINT _IconIDResource, LPCTSTR _ToolTipText, UINT _Message) 21 | { 22 | if(!_RecvHwnd || _IconIDResource <= 0 ){ 23 | return; 24 | } 25 | if(_Message != 0) m_uMessage = _Message; 26 | m_hIcon = LoadIcon(CPaintManagerUI::GetInstance(), MAKEINTRESOURCE(_IconIDResource)); 27 | m_trayData.cbSize = sizeof(NOTIFYICONDATA); 28 | m_trayData.hWnd = _RecvHwnd; 29 | m_trayData.uID = _IconIDResource; 30 | m_trayData.hIcon = m_hIcon; 31 | m_trayData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; 32 | m_trayData.uCallbackMessage = m_uMessage; 33 | if(_ToolTipText) _tcscpy(m_trayData.szTip, _ToolTipText); 34 | Shell_NotifyIcon(NIM_ADD, &m_trayData); 35 | m_bEnabled = true; 36 | } 37 | 38 | void CTrayIcon::DeleteTrayIcon() 39 | { 40 | Shell_NotifyIcon(NIM_DELETE, &m_trayData); 41 | m_bEnabled = false; 42 | m_bVisible = false; 43 | m_hWnd = NULL; 44 | m_uMessage = UIMSG_TRAYICON; 45 | } 46 | 47 | bool CTrayIcon::SetTooltipText( LPCTSTR _ToolTipText ) 48 | { 49 | if(_ToolTipText) _tcscpy(m_trayData.szTip,_ToolTipText); 50 | if (!m_bEnabled) return FALSE; 51 | m_trayData.uFlags = NIF_TIP; 52 | return Shell_NotifyIcon(NIM_MODIFY, &m_trayData) == TRUE; 53 | } 54 | 55 | bool CTrayIcon::SetTooltipText( UINT _IDResource ) 56 | { 57 | TCHAR mbuf[256] = {0}; 58 | LoadString(CPaintManagerUI::GetInstance(), _IDResource,mbuf, 256); 59 | return SetTooltipText(mbuf); 60 | } 61 | 62 | DuiLib::CDuiString CTrayIcon::GetTooltipText() const 63 | { 64 | return m_trayData.szTip; 65 | } 66 | 67 | bool CTrayIcon::SetIcon( HICON _Hicon ) 68 | { 69 | if(_Hicon) m_hIcon = _Hicon; 70 | m_trayData.uFlags = NIF_ICON; 71 | m_trayData.hIcon = _Hicon; 72 | 73 | if (!m_bEnabled) return FALSE; 74 | return Shell_NotifyIcon(NIM_MODIFY, &m_trayData) == TRUE; 75 | 76 | return false; 77 | } 78 | 79 | bool CTrayIcon::SetIcon( LPCTSTR _IconFile ) 80 | { 81 | HICON hIcon = LoadIcon(CPaintManagerUI::GetInstance(),_IconFile); 82 | return SetIcon(hIcon); 83 | } 84 | 85 | bool CTrayIcon::SetIcon( UINT _IDResource ) 86 | { 87 | HICON hIcon = LoadIcon(CPaintManagerUI::GetInstance(), MAKEINTRESOURCE(_IDResource)); 88 | return SetIcon(hIcon); 89 | } 90 | 91 | HICON CTrayIcon::GetIcon() const 92 | { 93 | HICON hIcon = NULL; 94 | hIcon = m_trayData.hIcon; 95 | return hIcon; 96 | } 97 | 98 | void CTrayIcon::SetHideIcon() 99 | { 100 | if (IsVisible()) { 101 | SetIcon((HICON)NULL); 102 | m_bVisible = TRUE; 103 | } 104 | } 105 | 106 | void CTrayIcon::SetShowIcon() 107 | { 108 | if (!IsVisible()) { 109 | SetIcon(m_hIcon); 110 | m_bVisible = FALSE; 111 | } 112 | } 113 | 114 | void CTrayIcon::RemoveIcon() 115 | { 116 | m_trayData.uFlags = 0; 117 | Shell_NotifyIcon(NIM_DELETE, &m_trayData); 118 | m_bEnabled = FALSE; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /CTrayIcon/TrayIcon.h: -------------------------------------------------------------------------------- 1 | #ifndef __UITRAICON_H__ 2 | #define __UITRAICON_H__ 3 | 4 | #pragma once 5 | #include 6 | 7 | namespace DuiLib 8 | { 9 | class UILIB_API CTrayIcon 10 | { 11 | public: 12 | CTrayIcon(void); 13 | ~CTrayIcon(void); 14 | 15 | public: 16 | void CreateTrayIcon( HWND _RecvHwnd, UINT _IconIDResource, LPCTSTR _ToolTipText = NULL, UINT _Message = NULL); 17 | void DeleteTrayIcon(); 18 | bool SetTooltipText(LPCTSTR _ToolTipText); 19 | bool SetTooltipText(UINT _IDResource); 20 | CDuiString GetTooltipText() const; 21 | 22 | bool SetIcon(HICON _Hicon); 23 | bool SetIcon(LPCTSTR _IconFile); 24 | bool SetIcon(UINT _IDResource); 25 | HICON GetIcon() const; 26 | void SetHideIcon(); 27 | void SetShowIcon(); 28 | void RemoveIcon(); 29 | bool Enabled(){return m_bEnabled;}; 30 | bool IsVisible(){return !m_bVisible;}; 31 | 32 | private: 33 | bool m_bEnabled; 34 | bool m_bVisible; 35 | HWND m_hWnd; 36 | UINT m_uMessage; 37 | HICON m_hIcon; 38 | NOTIFYICONDATA m_trayData; 39 | }; 40 | } 41 | #endif // 42 | 43 | -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MFCDuilibTest", "MFCDuilibTest\MFCDuilibTest.vcproj", "{CB6D676A-24B2-467F-B6C5-18C0C7EC4438}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} = {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} 7 | EndProjectSection 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DuiLib", "DuiLib\DuiLib.vcproj", "{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}" 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 13 | Debug|Win32 = Debug|Win32 14 | Release|Win32 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {CB6D676A-24B2-467F-B6C5-18C0C7EC4438}.Debug|Win32.ActiveCfg = Debug|Win32 18 | {CB6D676A-24B2-467F-B6C5-18C0C7EC4438}.Debug|Win32.Build.0 = Debug|Win32 19 | {CB6D676A-24B2-467F-B6C5-18C0C7EC4438}.Release|Win32.ActiveCfg = Release|Win32 20 | {CB6D676A-24B2-467F-B6C5-18C0C7EC4438}.Release|Win32.Build.0 = Release|Win32 21 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|Win32.ActiveCfg = Debug|Win32 22 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|Win32.Build.0 = Debug|Win32 23 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Win32.ActiveCfg = Release|Win32 24 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Win32.Build.0 = Release|Win32 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.aps -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.cpp -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.h -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.rc -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTest.vcproj -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTestDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTestDlg.cpp -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MFCDuilibTestDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "MainWnd.h" 4 | 5 | class CMFCDuilibTestDlg : public CDialog 6 | { 7 | public: 8 | CMFCDuilibTestDlg(CWnd* pParent = NULL); 9 | enum { IDD = IDD_MFCDUILIBTEST_DIALOG }; 10 | 11 | protected: 12 | virtual void DoDataExchange(CDataExchange* pDX); 13 | 14 | protected: 15 | HICON m_hIcon; 16 | MainWnd m_duiControl; 17 | 18 | virtual BOOL OnInitDialog(); 19 | afx_msg void OnSysCommand(UINT nID, LPARAM lParam); 20 | afx_msg void OnPaint(); 21 | afx_msg HCURSOR OnQueryDragIcon(); 22 | DECLARE_MESSAGE_MAP() 23 | public: 24 | afx_msg void OnBnClickedButton1(); 25 | }; 26 | -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MainWnd.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/MainWnd.cpp -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/MainWnd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | using namespace DuiLib; 4 | 5 | class MainWnd : public WindowImplBase 6 | { 7 | public: 8 | MainWnd(); 9 | ~MainWnd(); 10 | 11 | virtual LPCTSTR GetWindowClassName(void) const; 12 | virtual CDuiString GetSkinFolder(); 13 | virtual CDuiString GetSkinFile(); 14 | virtual void InitWindow(); 15 | virtual void Notify(DuiLib::TNotifyUI& msg); 16 | virtual HWND Subclass(HWND hWnd); 17 | 18 | protected: 19 | void AfterSubClassWnd(); 20 | 21 | private: 22 | DuiLib::CWebBrowserUI *m_pBrowser; 23 | }; 24 | -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/ReadMe.txt -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/res/MFCDuilibTest.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/res/MFCDuilibTest.ico -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/res/MFCDuilibTest.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/res/MFCDuilibTest.rc2 -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by MFCDuilibTest.rc 4 | // 5 | #define IDM_ABOUTBOX 0x0010 6 | #define IDD_ABOUTBOX 100 7 | #define IDS_ABOUTBOX 101 8 | #define IDD_MFCDUILIBTEST_DIALOG 102 9 | #define IDR_MAINFRAME 128 10 | #define IDC_DUISTATIC 1000 11 | #define IDC_BUTTON1 1001 12 | 13 | // Next default values for new objects 14 | // 15 | #ifdef APSTUDIO_INVOKED 16 | #ifndef APSTUDIO_READONLY_SYMBOLS 17 | #define _APS_NEXT_RESOURCE_VALUE 129 18 | #define _APS_NEXT_COMMAND_VALUE 32771 19 | #define _APS_NEXT_CONTROL_VALUE 1002 20 | #define _APS_NEXT_SYMED_VALUE 101 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/stdafx.cpp -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SECURE_ATL 4 | #define _SECURE_ATL 1 5 | #endif 6 | 7 | #ifndef VC_EXTRALEAN 8 | #define VC_EXTRALEAN 9 | #endif 10 | 11 | #include "targetver.h" 12 | 13 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS 14 | 15 | #define _AFX_ALL_WARNINGS 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | 23 | #ifndef _AFX_NO_OLE_SUPPORT 24 | #include 25 | #endif 26 | #ifndef _AFX_NO_AFXCMN_SUPPORT 27 | #include 28 | #endif 29 | 30 | //#include 31 | #define CWinAppEx CWinApp 32 | 33 | 34 | #include "UIlib.h" 35 | #ifdef _DEBUG 36 | #pragma comment(lib,"DuiLib_d.lib") 37 | #else 38 | #pragma comment(lib,"DuiLib.lib") 39 | #endif 40 | 41 | #ifdef _UNICODE 42 | #if defined _M_IX86 43 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 44 | #elif defined _M_IA64 45 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") 46 | #elif defined _M_X64 47 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 48 | #else 49 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 50 | #endif 51 | #endif 52 | 53 | 54 | -------------------------------------------------------------------------------- /MFC_Duilib_WND/MFCDuilibTest/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanttobeno/Duilib_Extension/9bc9205e57f47bf49a051c9d4bc624a8ce5762c4/MFC_Duilib_WND/MFCDuilibTest/targetver.h -------------------------------------------------------------------------------- /MFC_Duilib_WND/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | #### Duilib和MFC混合使用 4 | 5 | 6 | ##### duilib子窗口作为成员变量初始化 7 | 8 | duilib 窗口最为MFC的子窗口,在OnInitDialog中初始化 9 | 10 | ```c++ 11 | m_duiControl.Subclass(GetDlgItem(IDC_DUISTATIC)->GetSafeHwnd()); 12 | ``` 13 | 14 | ##### 创建duilib实现 15 | ```c++ 16 | class MainWnd:public WindowImplBase 17 | { 18 | 19 | HWND MainWnd::Subclass(HWND hWnd) 20 | { 21 | CWindowWnd::Subclass(hWnd); 22 | AfterSubClassWnd(); 23 | return m_hWnd; 24 | } 25 | // ... 26 | void AfterSubClassWnd() 27 | { 28 | LONG styleValue = ::GetWindowLong(*this, GWL_STYLE); 29 | styleValue &= ~WS_CAPTION; 30 | ::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); 31 | RECT rcClient; 32 | ::GetWindowRect(*this, &rcClient); 33 | HWND parentWnd=::GetParent(m_hWnd); 34 | POINT pt={rcClient.left,rcClient.top}; 35 | if (parentWnd!=NULL) 36 | { 37 | ::ScreenToClient(parentWnd,&pt); 38 | } 39 | ::SetWindowPos(*this, NULL, pt.x, pt.y, rcClient.right - rcClient.left, \ 40 | rcClient.bottom - rcClient.top, SWP_FRAMECHANGED); 41 | 42 | m_PaintManager.Init(m_hWnd); 43 | m_PaintManager.AddPreMessageFilter(this); 44 | 45 | CDialogBuilder builder; 46 | CDuiString strResourcePath=m_PaintManager.GetInstancePath(); 47 | strResourcePath+=GetSkinFolder().GetData(); 48 | m_PaintManager.SetResourcePath(strResourcePath.GetData()); 49 | 50 | switch(GetResourceType()) 51 | { 52 | case UILIB_ZIP: 53 | m_PaintManager.SetResourceZip(GetZIPFileName().GetData(), true); 54 | break; 55 | case UILIB_ZIPRESOURCE: 56 | { 57 | HRSRC hResource = ::FindResource(m_PaintManager.GetResourceDll(), GetResourceID(), _T("ZIPRES")); 58 | if( hResource == NULL ) 59 | return; 60 | DWORD dwSize = 0; 61 | HGLOBAL hGlobal = ::LoadResource(m_PaintManager.GetResourceDll(), hResource); 62 | if( hGlobal == NULL ) 63 | { 64 | #if defined(WIN32) && !defined(UNDER_CE) 65 | ::FreeResource(hResource); 66 | #endif 67 | return; 68 | } 69 | dwSize = ::SizeofResource(m_PaintManager.GetResourceDll(), hResource); 70 | if( dwSize == 0 ) 71 | return; 72 | m_lpResourceZIPBuffer = new BYTE[ dwSize ]; 73 | if (m_lpResourceZIPBuffer != NULL) 74 | { 75 | ::CopyMemory(m_lpResourceZIPBuffer, (LPBYTE)::LockResource(hGlobal), dwSize); 76 | } 77 | #if defined(WIN32) && !defined(UNDER_CE) 78 | ::FreeResource(hResource); 79 | #endif 80 | m_PaintManager.SetResourceZip(m_lpResourceZIPBuffer, dwSize); 81 | } 82 | break; 83 | } 84 | 85 | CControlUI* pRoot=NULL; 86 | if (GetResourceType()==UILIB_RESOURCE) 87 | { 88 | STRINGorID xml(_ttoi(GetSkinFile().GetData())); 89 | pRoot = builder.Create(xml, _T("xml"), this, &m_PaintManager); 90 | } 91 | else 92 | pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager); 93 | ASSERT(pRoot); 94 | if (pRoot==NULL) 95 | { 96 | MessageBox(NULL,_T("加载资源文件失败"),_T("Duilib"),MB_OK|MB_ICONERROR); 97 | ExitProcess(1); 98 | return; 99 | } 100 | 101 | m_PaintManager.AttachDialog(pRoot); 102 | m_PaintManager.AddNotifier(this); 103 | m_PaintManager.SetBackgroundTransparent(TRUE); 104 | 105 | InitWindow(); 106 | return; 107 | } 108 | 109 | ``` -------------------------------------------------------------------------------- /MFC_Duilib_WND/Skin/MainWnd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |