Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long
Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Dim w As Integer, h As Integer
Dim bm As BITMAP, hBitmap As Long
Dim hMemDC As Long, hMemDcTemp As Long
GetObject hBmp, LenB(bm), bm
w = bm.bmWidth
h = bm.bmHeight
if (bMemDC) // Create a Memory DC
{
pDC->GetClipBox(&Memrect);
if(Memrect.IsRectEmpty()) return;
pMemDC->CreateCompatibleDC(pDC);
Membitmap.CreateCompatibleBitmap(pDC,
Memrect.Width(), Memrect.Height());
pOldBitmap = pMemDC->SelectObject(&Membitmap);
pMemDC->SetWindowOrg(Memrect.left, Memrect.top);
CBrush aBrush(GetDocument()->m_BackColor);
pMemDC->FillRect( &Memrect , &aBrush);
pMemDC->SelectObject(::GetStockObject(NULL_BRUSH));
}
if (bMemDC)//draw material rect,HW
{
//往这里输出东东,用pMemDC。
}
if (bMemDC)
{
// Copy the offscreen bitmap onto the screen.
pDC->BitBlt(Memrect.left, Memrect.top, Memrect.Width(), Memrect.Height(),
pMemDC, Memrect.left, Memrect.top, SRCCOPY);
//Swap back the original bitmap.
pMemDC->SelectObject(pOldBitmap);
}