C++ Code_ImageList
|
主题 |
|
1. 创建图像列表 2. 使用图像列表绘图 3. 4. 5. |
|
代码::创建图像列表 |
|
双击 Cproject03Dlg在
下面添加 1 句
/////////////////////////////////////////////////////////////////////////////
// CProject01Dlg dialog
// class CProject01Dlg : public
CDialog // {
// Construction
// public:
// CProject01Dlg(CWnd* pParent = NULL);
// standard constructor CImageList m_ImgLst;
手动在资源编辑器中添加 3 个Icon资源
双击 OnInitDialog()在
// TODO: Add extra initialization here
添加如下代码
// TODO: Add extra initialization
here m_ImgLst.Create( 32
, 32 ,ILC_COLOR24 | ILC_MASK, 1 , 0 ); m_ImgLst.Add( LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON1)) );
m_ImgLst.Add( LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON2)) );
m_ImgLst.Add( LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON3)) ); 使用图像列表绘图
CImageList m_ImgLst;
双击OnPaint()添加如下代码
//void
CProject01Dlg::OnPaint() //{
// if (IsIconic())
// {
// CPaintDC dc(this); // device context
for painting //
// SendMessage(WM_ICONERASEBKGND,
(WPARAM) dc.GetSafeHdc(), 0); //
// // Center icon in client
rectangle // int cxIcon =
GetSystemMetrics(SM_CXICON); // int cyIcon =
GetSystemMetrics(SM_CYICON); // CRect rect;
//
GetClientRect(&rect); // int x = (rect.Width() - cxIcon + 1) /
2; // int y = (rect.Height() - cyIcon + 1)
/ 2; //
// // Draw the icon
// dc.DrawIcon(x, y,
m_hIcon); // }
// else
// {
// CDialog::OnPaint();
CDC
* pDC = GetDC(); CPoint
pt; pt.x = 30 ;
pt.y = 50 ;
for
( int i = 0 ;i < 3 ;i ++ ) {
pt.x += 60 ;
m_ImgLst.Draw(pDC,i,pt,ILD_NORMAL);
}
ReleaseDC(pDC);
// }
//
} 效果图:
|
C++ Code_ImageList的更多相关文章
随机推荐
- 【LR】OSGI性能测试实例
其实我们就两点Ø 确定测试登录最大并发用户数:Ø 事务平均响应时间 (两个查询) 得到这个任务 如何展开测试工作呢? 一.WindowsResources 设置(其实不监控 设不设都行 我感觉) ...
- slowhttps安装及使用心得
运行及安装环境,kali. 到googlecode上下载安装包,cd到安装目录./configure 运行完毕后输入make 结束后make install 简单点就直接apt-get install ...
- ASP.NET转换人民币大小金额
public class DecimalToRMB { /// <summary> /// 转换人民币大小金额 /// </sum ...
- 现代浏览器内置的可等效替代jQuery的功能
jQuery的体积在不断的增大.新功能要不断增加,这是必然结果.虽然从版本1.8.3开始的瘦身效果明显,但不可否认的是,对于移动手机端的网 页开发,它仍然是不可接受的.当然,jQuery不是铁板一块, ...
- [Lua]入门教程
什么是Lua Lua 是一个小巧的脚本语言.是巴西里约热内卢天主教大学(Pontifical Catholic University of Rio de Janeiro)里的一个研究小组,由Rober ...
- 服务器进程为何通常fork()两次
首先,要了解什么叫僵尸进程,什么叫孤儿进程,以及服务器进程运行所需要的一些条件.两次fork()就是为了解决这些相关的问题而出现的一种编程方法. 孤儿进程 孤儿进程是指父进程在子进程结束之前死亡(re ...
- Windows Azure Platform 系列文章目录
Windows Azure Platform (一) 云计算的出现 Windows Azure Platform (二) 云计算的分类和服务层次 Windows Azure Platform (三) ...
- js_sl 无缝切换
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- Styling FX Buttons with CSS
http://fxexperience.com/2011/12/styling-fx-buttons-with-css/ ——————————————————————————————————————— ...
- HDU 1787 GCD Again(欧拉函数,水题)
GCD Again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
