(1)CImageList m_ImageList;
(2)在OnInitDialog()中创建图像列表控件
m_ImageList.Create(128,128,ILC_COLOR24|ILC_MASK,1,0);
m_ImageList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON1)));
m_ImageList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON2)));
m_ImageList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON3)));
m_ImageList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_ICON5)));
(3)在OnPaint()方法中调用图像列表控件的Draw方法绘制图表
CDialog::OnPaint();
CDC *pDC=GetDlgItem(IDC_BUTTON1)->GetDC();
CPoint pt;
pt.x=100;
pt.y=100;
for(int i=0;i<4;i++)
{
pt.x+=120;
m_ImageList.Draw(pDC,i,pt,ILD_NORMAL);
}
ReleaseDC(pDC);