[求助]怎样用vc++绘制图形?
怎样用vc++绘制图形?还有在vc++6.0的环境里绘制图形的步骤是什么啊?我对vc++6.0的环境不熟悉!小弟在此谢过了!
BOOL COOP_MazeDlg::OnInitDialog()
{
const CString ArrowName[7]={"image\\0.bmp","image\\1.bmp","image\\2.bmp","image\\3.bmp",
"image\\4.bmp","image\\入口.bmp","image\\出口.bmp"};
for(int i=0;i<7;i++)
{
m_hBitmapArrow[i]=(HBITMAP)::LoadImage(AfxGetInstanceHandle(),
ArrowName[i]/*dlg.GetPathName()*/,IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
m_bmpArrow[i].Attach(m_hBitmapArrow[i]);
}//for
}
void COOP_MazeDlg::Arrow(int xx, int yy, int id)
{
if(!m_hBitmapArrow[id])
return;
BITMAP bm;
m_bmpArrow[id].GetObject(sizeof(BITMAP),&bm);
CDC* pDC=GetDC();
int nWidth,nHeight,nX=0,nY=0;
nWidth=bm.bmWidth;
nHeight=bm.bmHeight;
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
CBitmap* pOldbmp=dcMem.SelectObject(&m_bmpArrow[id]);
pDC->StretchBlt(xx,yy,size,size,&dcMem,0,0,nWidth,nHeight,SRCCOPY);
dcMem.SelectObject(pOldbmp);
}