ramilol 0 Newbie Poster

ok so im trying to use double buffer to make smooth animation but i can't get it to work here is the code for my drawing

VOID onPaint(HDC hdc,HWND hWnd) 
{ 
    HDC hDC=GetDC(hWnd); 
    HDC memDC = CreateCompatibleDC(hDC); 
    HBITMAP hMemBmp = CreateCompatibleBitmap(hDC,300,300); 
    HBITMAP hOldBmp =  (HBITMAP)SelectObject(memDC,hMemBmp);
    Graphics graphics(memDC); 
    Pen      pen(Color(255, 0, 0, 255)); 
    graphics.DrawEllipse(&pen, sf , 0, 25, 25); 
 
    // now that you've drawn on the offscreen map, go ahead 
    // and put it on screen. 
    BitBlt(hDC, 0, 0, 300, 300, memDC, 0, 0, SRCCOPY);

    // Always select the old bitmap back into the device context 
    SelectObject(memDC, hOldBmp); 
    DeleteObject(hMemBmp); 
    DeleteDC(memDC);
    ReleaseDC(hWnd,hDC);
}

i have been asking this for while some help me already
thanks
Rami

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.