用下面的方法动态载入图片,现在想在显示的图片中单击弹出一个对话框,应该如何添加消息?
或者有更好的方法能动态载入图片,然后能在显示的图片中单击弹出一个对话框?谢谢 CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1); BITMAP bmp;
bitmap.GetBitmap(&bmp); CDC dcCompatible;
dcCompatible.CreateCompatibleDC(pDC); dcCompatible.SelectObject(&bitmap); CRect rect;
GetClientRect(&rect);
// pDC->BitBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,0,0,SRCCOPY);
pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,
0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
或者有更好的方法能动态载入图片,然后能在显示的图片中单击弹出一个对话框?谢谢 CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1); BITMAP bmp;
bitmap.GetBitmap(&bmp); CDC dcCompatible;
dcCompatible.CreateCompatibleDC(pDC); dcCompatible.SelectObject(&bitmap); CRect rect;
GetClientRect(&rect);
// pDC->BitBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,0,0,SRCCOPY);
pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&dcCompatible,
0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
你应该给某个窗体加单击的消息相应,而这个窗体上绘制你要的图片。
void CXXXView::OnLButtonDown(UINT nFlags, CPoint point)
{
if(rect.PtInRect(pint))
{
CDLg dlg;
dlg.DoModal();
}
}
void CXXXView::OnLButtonDown(UINT nFlags, CPoint point)
{
if(rect.PtInRect(point) && bOpen) //rect 你的图像区域 bOpen是否载入了图像
{
CDLg dlg;
dlg.DoModal();
}
}
请问rect和bopen如何得到?
另外程序中需要动态显示多个图片,如何区别不同的图片?