HBITMAP dcimage;
Bitmap b(800,800);
HDC hdc;
hdc = BeginPaint(g_hDialogWindow, &ps);
Graphics graphics(g_hDialogWindow);
Graphics *graphics2=Graphics::FromImage(&b);
Pen pen(Color(255, 40,40,40),2);
SolidBrush brush(Color::White);
graphics.FillRectangle(&brush, 0, 0, 400,400);
graphics2->FillRectangle(&brush, 0, 0, 400,400);
graphics.DrawLine(&pen,0,0,600,600);
graphics2->DrawLine(&pen,0,0,400,400);
b.GetHBITMAP(Color(255,255,255),&dcimage);
BITMAP bm;
HDC hdcMem = CreateCompatibleDC(hdc);
SelectObject(hdcMem, dcimage);
GetObject(dcimage, sizeof(bm), &bm);
BitBlt(hdc,rect.left, rect.top, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);
EndPaint(g_hDialogWindow, &ps);
thanks guys... :)