Click to See Complete Forum and Search --> : Problem with drawing lines on bitmap


Janzki
April 28th, 2004, 05:53 PM
Hi,

Newbie here and in visual c++ programming :)

I have a problem prgramming an analog clock. It uses a transparent bitmap as a background (circular clockface) and filled polygons and lines as the clock hands.

The problem is that whenever the hands move they leave a "mark" behind. They just keep drawing new ones without erasing the older ones. How can I erase them? Refreshing maybe?

Don't know if this is enough info on the problem but thanks in advance.

-Janzki

hvjahagirdar
April 29th, 2004, 02:42 AM
Use Invalidate() .

Janzki
April 29th, 2004, 02:55 AM
I tried but ti get caught in a loop I guess beacause it shoot sthe PO to 100% straight away. Not sure if I'm doing it the proper way....

-Janzki

ovidiucucu
April 29th, 2004, 09:25 AM
They just keep drawing new ones without erasing the older ones.
Possible, because you must also draw the background bitmap before clock hands.

I tried but ti get caught in a loop I guess beacause it shoot sthe PO to 100% straight away.
From where are you calling Invalidate()? From a loop? From the WM_PAINT message handler?

Set a timer (e.g. of one second time-out) value and call Invalidate() from WM_TIMER handler.

Just I can presume what you did wrong, because your question gives too few info.

Eventually, post the code here.

Janzki
April 29th, 2004, 09:40 AM
Got it working.
It was a refresh issue.
Invalidate(); worked eventually :)

-Thanks