网上找了很多,都不清不楚。。
有人可以写一下么?
位图已经添加到了资源里。

解决方案 »

  1.   

    最简单的,还用双缓存了,呵呵        CDC memdc;
    CBitmap bmp;
    BITMAP pbmp;
    int i_width;
    int i_height; bmp.LoadBitmap(IDB_BITMAP1);
    bmp.GetBitmap(&pbmp);
    i_width = pbmp.bmWidth;
    i_height = pbmp.bmHeight;
    memdc.CreateCompatibleDC(NULL);
    memdc.SelectObject(bmp); //整幅图拷贝
    pDC->BitBlt(0,0,i_width,i_height,&memdc,0,0,SRCCOPY);
      

  2.   

    加载什么的楼主可以卸载OnInitDialog或者OnInitUpdate里面,pDC->输出一定要在On_Paint里控制
      

  3.   

    嗟夫。自己回贴吧:
    正确方案:
    void CGamepadPaintView::OnPaint()
    {
    CPaintDC dcWnd(this);
    CMemDC dc(&dcWnd); DrawImg(dc, m_Bitmap, IDB_BITMAP_SIGN_DIRECT, 10, 10, 80, 80);
    }void CGamepadPaintView::DrawImg(CDC& dc, CBitmap& bitmap, DWORD bmpID, int x, int y, int width, int height, DWORD colorkey/*=0x000000*/)
    {
    CDC ImageDC;
    CBitmap* pOldImageBMP = NULL; bitmap.LoadBitmap(bmpID);
    ImageDC.CreateCompatibleDC(&dc);
    pOldImageBMP = ImageDC.SelectObject(&bitmap);
    TransparentBlt(dc.m_hDC, x, y, width, height, ImageDC.m_hDC, 0, 0, width, height, colorkey); // colorkey为关键色作透明色
    ImageDC.SelectObject(pOldImageBMP);
    bitmap.DeleteObject();
    }