在mfc中使用gdiplus调用皮肤组件

来源:互联网 发布:js 日期转字符串 编辑:程序博客网 时间:2024/06/05 05:02

李国帅 2011.12.8

在vc中为了界面美观经常使用皮肤,而皮肤控件很多,这里介绍一种曾经使用的皮肤插件。

头文件

#include <gdiplus.h>#pragma comment(lib, "gdiplus.lib")using namespace Gdiplus;#include "GdiManger.h"#include "GdipButton.h"#include "ReportCtrl.h"#include "TransparentStatic.h"#include "TGroupBox.h"

声明和初始化

ULONG_PTR m_gdiplusToken;//    GdiplusStartupInput gdiplusStartupInput;//初始化BOOL CdemoApp::InitInstance()    GdiplusStartup(&m_gdiplusToken,&gdiplusStartupInput,NULL);    Gdiplus::GdiplusShutdown(m_gdiplusToken);//去初始化    Gdiplus::GdiplusShutdown(m_gdiplusToken);


对话框头文件中定义对象

CGdiManger            m_oGdiManager;    CGdipButton m_btnCIFD1;    DDX_Control(pDX, IDC_BTN_D1, m_btnCIFD1);


初始化函数中

m_btnCIFD1.EnableWindow(bEnable);    m_btnCIFD1.LoadStdImage(IDR_D1_BTN, "PNG");    m_btnCIFD1.MoveWindow(230+28+10, 7, 28, 27);    strText.LoadString(IDS_TOOLBAR_STR_2);    m_btnCIFD1.SetToolTipText(strText);    m_btnCIFD1.ShowWindow(SW_HIDE);

刷新背景

BOOL CDeviceListDlg::OnEraseBkgnd(CDC* pDC){    // TODO: Add your message handler code here and/or call default    char szmoduleDir[1024]; // module path without '\' at the end    memset(szmoduleDir, 0, 1024);    strcpy(szmoduleDir, GetModuleFileDirectory().c_str());    CString  strFilePath;    strFilePath.Format("%sImages\\DevlistBk.png", szmoduleDir);    CRect  rect;    GetClientRect(&rect);    m_oGdiManager.DrawBitMap(strFilePath, rect, pDC);    m_btnCIFD1.SetBkGnd(pDC);    return TRUE;    //return CDialog::OnEraseBkgnd(pDC);}
阅读全文
'); })();
0 0
原创粉丝点击
热门IT博客
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 吕布袁术 孙策 袁术 孙策和袁术 三国杀 袁术 袁术孙策 袁术三国杀 三国之我是袁术txt下载 三国之袁术是我爹 袁术怎么死的 袁术天下 银苑书生 三国杀袁术图片 三国之我是袁术 长不大的肥猫 三国杀袁术怎么得 三国杀袁术为什么叫术爸 长不大的肥猫 三国之我是袁术 袁杰 醉千年李袁杰 袁枚 袁枚怎么读 题画袁枚 子不语袁枚 袁枚简介 袁枚所见 袁枚拼音 苔 袁枚 所见 袁枚 子不语 袁枚 袁枚诗苔的作文800字 山行杂咏袁枚 袁枚诗 袁柯 中国古代神话 袁殊 袁殊简历 袁毅 袁氏 袁氏风流 东汉袁氏 三国之袁氏枭雄 袁泓 袁洪 袁洪的来历