更新时间:2023-11-18 12:39:04
您的意思是 [ ^ ](然后您可以使用 Bitmap.GetHBITMAP [
Do you mean "How To Draw on a Memory Bitmap in GDI+"[^] (you may then use the Bitmap.GetHBITMAP[^] to retrieve the HBITMAP
).
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... :)