Clearing CDC
-
Hi, Is there any way to clear the contents in CDC of a client window ? I have a transparent image in my CDC, and before drawing the next image, I would like to clear and reset the DC. Thanks Jugs "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
-
Hi, Is there any way to clear the contents in CDC of a client window ? I have a transparent image in my CDC, and before drawing the next image, I would like to clear and reset the DC. Thanks Jugs "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
-
Use the
Invalidate(true)
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
Hi, Thanks for the reply. I want to clear the CDC from inside OnPaint(). Calling Invalidate( ) of CWnd will again invoke the OnPaint. I am getting a DC inside OnPaint which contains an already painted image, which I would like to remove. I would like to draw a new Transparent image, But since the previous image is already there and the new image is transparent, I am having problems. Thanks Jugs "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
-
Hi, Thanks for the reply. I want to clear the CDC from inside OnPaint(). Calling Invalidate( ) of CWnd will again invoke the OnPaint. I am getting a DC inside OnPaint which contains an already painted image, which I would like to remove. I would like to draw a new Transparent image, But since the previous image is already there and the new image is transparent, I am having problems. Thanks Jugs "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
Is your background simple enough that you could just fill it with a background color?
pDC->FillSolidRect(rect, RGB(255,0,0));
"When you know you're going to eat crow, it's best to eat it while it's still warm." - Reader's Digest