用下面的方法动态载入图片,现在想在显示的图片中单击弹出一个对话框,应该如何添加消息?
或者有更好的方法能动态载入图片,然后能在显示的图片中单击弹出一个对话框?谢谢     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);

解决方案 »

  1.   

    pDC是哪儿来的?窗体的吧?
    你应该给某个窗体加单击的消息相应,而这个窗体上绘制你要的图片。
      

  2.   


    void CXXXView::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    if(rect.PtInRect(pint))
    {
    CDLg dlg;
    dlg.DoModal();
    }
    }
      

  3.   


    void CXXXView::OnLButtonDown(UINT nFlags, CPoint point)  

    if(rect.PtInRect(point) && bOpen) //rect 你的图像区域 bOpen是否载入了图像

    CDLg dlg; 
    dlg.DoModal(); 

    }
      

  4.   

    多谢3楼的
    请问rect和bopen如何得到?
    另外程序中需要动态显示多个图片,如何区别不同的图片?
      

  5.   

    你显示图片不就要知道图片的大小、位置吗?这就组成了图片的包围矩形rect。