MFC添加背景图片,位图
来源:互联网 发布:java war包 编辑:程序博客网 时间:2024/05/16 04:59
标题一:添加背景图片使用CBrush 背景刷色
TestDlg.h中 CBrush m_brBk;//在public中定义 TestDlg.cpp中 在初始化函数OnInitDialog()中加入: BOOL CTestDlg::OnInitDialog() { CDialog::OnInitDialog(); CBitmap bmp; bmp.LoadBitmap(IDB_BITMAP2); m_brBk.CreatePatternBrush(&bmp); bmp.DeleteObject(); return TRUE; // return TRUE unless you set the focus to a control } 在打开类向导,找到WM_CTLCOLOR消息,重载得对应函数OnCtlColor(),添加如下: HBRUSH CTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if (pWnd == this) { return m_brBk; } return hbr; }
标题二:添加button位图
1.MyButtonDlg.h 里添加
CBitmapButton m_close;
2.关联m_close
3.资源视图里添加bitmap位图
4.OnInitDialog()函数添加以下代码
BOOL CMyButtonDlg::OnInitDialog(){ CDialogEx::OnInitDialog(); CBitmap bmp; bmp.LoadBitmap(IDB_BITMAP1); m_brbk.CreatePatternBrush(&bmp); bmp.DeleteObject(); //OnInitDialog()函数添加以下代码 **m_close.LoadBitmaps(IDB_BITMAP3,IDB_BITMAP1,IDB_ BITMAP3,IDB_BITMAP2); m_close.SizeToContent();//按钮适用图片大小** ...
5.OVER效果图
1 0
- MFC添加背景图片,位图
- MFC对话框添加背景图片
- MFC对话框添加背景图片
- MFC对话框添加背景图片
- MFC添加背景图片方法
- MFC 对话框添加背景图片
- MFC对话框添加背景图片
- MFC添加背景图片方法
- mfc中添加背景图片
- mfc窗口添加背景图片
- MFC对话框添加背景图片
- MFC添加背景图片方法
- mfc窗口添加背景图片
- MFC 中添加背景图片
- MFC添加背景图片
- MFC,添加背景图片
- MFC在对话框中添加背景图片导入位图出错的解决方法
- MFC添加位图按钮
- linux sed命令详解
- __weak && __block
- 中山大学 斐波那契装箱问题
- 看烦了电影,看看代码直播吧
- 内存对齐
- MFC添加背景图片,位图
- python邮件发送
- bean validation 1.1----学习笔记
- Jquery中对(function($) {})(jQuery)的理解
- Xcode编译问题-The operation couldn’t be completed. (LaunchServicesError error 0.)
- java线程的一些学习总结
- CentOS 7下源码安装MySQL 5.6
- Java socket编程
- Hbase 布隆过滤器BloomFilter介绍