I support some code that contains the following:
Canvas.Refresh; SavedDC := SaveDC(Canvas.Handle); try
I found out that TCanvas.Refresh is not like updating a component. This does not cause anything to paint, it simply invalidates the font, pen and canvas brush .
I do not understand why you called .Refresh before saving the DC, and then after restoring it. It is like defeating the goal of SaveDC / RestoreDC calls.
A more reasonable order for these calls is as follows:
SaveDC(Canvas.Handle) Canvas.Refresh try // Do my painting finally RestoreDC(Canvas.Handle, SavedDC); end;
Since I never saw or used the TCanvas.Refresh method, I wanted to check and make sure I understood correctly.
source share