[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

CopyFromMemoryDC Question



I have been trying to create a function to display an analog meter face.  My
idea is that I should create a 
MemoryDC once at Meter instantiation to draw the face background .  As well,
I should create another MemoryDC
into which I will copy the meter face.  I would then draw the meter
indicator needle in this MemoryDC and then
copy the meter face and needle to the visible canvas.  This would allow me
to only draw the face once, then
every time I wanted to draw a new needle position I could copy over the old
face and needle with a clean face
then draw the new needle.  I would not have to remember the location of the
needle and erase it each time.

The CopyFromMemoryDC seems to assume that the copy is from a different
drawing canvas into the current DC.
First, Would you create a Meter object with the three canvases, the meter
face canvas, the meter face with
needle canvas and the visible canvas?  Or would you create three different
objects, one for the meter face with
memoryDC, one for the meter face with needle memoryDC, and one for the
visible canvasDC.

Now how would I copy from one drawing canvas to the next with
CopyFromMemoryDC? 
I assume that I will have to set my meter face memory drawing canvas to be
the current one to draw
the meter face, then change the pointer to point to the memory canvas for
drawing the needle before
I can copy the face into the new memory canvas and draw the needle.  Then I
would have to change
the pointer again to point to the visible canvas before I copied the meter
face with needle to
the visible canvas. How do you change the pointer to the current DC to point
to the destination drawing canvas?

Any suggestions which could get me on my way would be appreciated.

Calvin McCarthy



Reply to: