pDC, CPoint pt )
{
    CDC MemDC;
    MemDC.CreateCompatibleDC(pDC);
    CBitmap *pOldBitmap = (CBitmap*)MemDC.SelectObject(pBitmap);

    BITMAP bm;
    pBitmap
->GetBitmap(&bm);
    
int li_Width = bm.bmWidth;
    
int li_Height = bm.bmHeight;

    pDC
->BitBlt(pt.x, pt.y, li_Width, li_Height, &MemDC, 00, SRCCOPY);

    MemDC.SelectObject(pOldBitmap);
    MemDC.DeleteDC();
}

//平铺画位图
void CFriendDlg::DrawRangeImage(CBitmap *pBitmap, CDC *pDC, CRect rc)
{
    CDC MemDC;
    BITMAP bm;
    pBitmap
->GetBitmap(&bm);

    
int li_Width = bm.bmWidth;
    
int li_Height = bm.bmHeight;

    MemDC.CreateCompatibleDC(pDC);
    CBitmap
* pOldBitmap = MemDC.SelectObject(pBitmap);

    
int x=rc.left;
    
int y=rc.top;
    
while (y < (rc.Height()+rc.top)) 
    {
        
while(x < (rc.Width()+rc.left)) 
        {
            pDC
->BitBlt(x, y, li_Width, li_Height, &MemDC, 00, SRCCOPY);
            x 
+= li_Width;
        }
        x 
= rc.left;
        y 
+= li_Height;
    }

    MemDC.SelectObject(pOldBitmap);
    MemDC.DeleteDC();
}

相关文章:

  • 2022-12-23
  • 2021-11-22
  • 2021-06-10
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2021-12-23
  • 2021-10-31
  • 2021-09-26
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案