Home > Back-end >  For help! The memory about GDI drawing, FromImage the use of the ()
For help! The memory about GDI drawing, FromImage the use of the ()

Time:02-15

I want to do with GDI + double buffer drawing, thinking, memory, create two Bitmap Bitmap Bitmap Bitmap and B, with A Graphics object gpMem associated with one, need to drawing on A connection. A, B is needed in the drawing the connection B, but the results are not achieve them,
Test code and operation result is as follows, expected results should only use a line, but the actual output 2 line, that is associated with a bitmap B of the code is not work, what is my way of thinking is the principle of closing, or other problems, in addition to this method, I can only think of "a" Graphics object associated with a bitmap, the great god: are there any other way?
 
CClientDC dc (this);//DC

Bitmap bmpA (500, 500);//bitmap A
Bitmap bmpB (100, 100);//bitmap B

Graphics gpDC (dc);//associated DC

Graphics gpMem (& amp; BmpA);//associated bitmap A

Pen newPen (Color (0, 255), 4);//brush set

GpMem. Clear (Color (255255255));//background color all white

GpMem. DrawLine (& amp; NewPen, 200, 200, 400, 400);//draw a diagonal line downwards

GpMem. FromImage (& amp; BmpB);//associated bitmap B invalid (why?)

GpMem. DrawLine (& amp; NewPen, 200, 200, 400, 0). Draw a line of oblique upward long//

GpDC. DrawImage (& amp; BmpA, 0, 0);//output to a window


  • Related