Should I always replace default object after it has finished work with the new object when I Use DC

90 views Asked by At

I just use a temp DC created with:

::CreateCompatibleDC(NULL);

Then I draw some image to this temp DC. I want to get the image in this DC, so I use CreateCompatibleBitmap() to create a temp bitmap and use SelectObject() to get the original HBITMAP in the DC.

I just want to DeleteDC() right now and after I'm done using the original bitmap, delete the original bitmap.

Is this wrong ?

Should I always replace original object after it has finished work with the new object when I Use DC ?

1

There are 1 answers

0
DECO1988 On

I think I am wrong.I can first create a bitmap and select it into the temp DC and after I'm done with the drawing. I can replace it with the original object. I think this is the right way to solve the problem.