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的更多相关文章
随机推荐
- Sikuli简介
Sikuli是利用屏幕上能够看到的图型做自动化,能够通过这个手段来识别和控制元素,非常适合和Selenium和Robot Framework一起结合起来做自动化. 1.Sikuli主页 http:// ...
- Red and Black ---路线问题
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A ...
- 【DWT笔记】傅里叶变换与小波变换
[DWT笔记]傅里叶变换与小波变换 一.前言 我们经常接触到的信号,正弦信号,余弦信号,甚至是复杂的心电图.脑电图.地震波信号都是时域上的信号,我们也成为原始信号,但是通常情况下,我们在原始信号中得到 ...
- 【LeetCode】231 - Power of Two
Given an integer, write a function to determine if it is a power of two. Solution:一个整数如果是2的整数次方,那么它的 ...
- Http状态码的种类及含义
1xx 临时响应:2xx 成功:3xx 重定向: 4xx 请求错误: 5xx 服务器错误: http://www.hostspaces.net/wenzhang-detail.php?id=198 常 ...
- BITED数学建模七日谈之三:怎样进行论文阅读
前两天,我和大家谈了如何阅读教材和备战数模比赛应该积累的内容,本文进入到数学建模七日谈第三天:怎样进行论文阅读. 大家也许看过大量的数学模型的书籍,学过很多相关的课程,但是若没有真刀真枪地看过论文,进 ...
- 有趣的库:pipe(类似linux | 管道)库
pipe并不是Python内置的库,如果你安装了easy_install,直接可以安装它,否则你需要自己下载它:http://pypi.python.org/pypi/pipe 之所以要介绍这个库,是 ...
- 【开源项目之路】jquery的build问题
在刚开始clone了jquery到本地build的时候,就遇到了问题. “ENORESTARGET No tag found that was able to satisfy ...” 提示为bowe ...
- shell学习目录
1. 了解shell 2. shell 入门基础 3. Shell脚本文件中常用的操作语句
- 阿里云存储OSS之九大使用技巧
http://www.biphp.com/cloud-computing/%E9%98%BF%E9%87%8C%E4%BA%91%E5%AD%98%E5%82%A8oss%E4%B9%8B%E4%B9 ...
