> I am using textout() to write text to the canvas of a TChart which 
> works fine, except that when a redraw occurs (e.g. when resizing 
> the form) the text disappears.   I  have struck similar behaviour 
> when writing to the canvas of a form,  though I also have some test 
> code from the Delphi 4 Developers Guide which appears basically 
> the same and which works fine.
> 
> Am I missing something e.g. a parameter setting somewhere?  

Technique perhaps?? You have set up your Onrepaint handler so it can restore the 
canvas completely. This means knowing some sort of "state" about how your canvas
should look. I generally have my screen drawing in a routine called from
OnPaint. When I wont to add something to the canvas, I modify the mechanism
by which I store State and then invalidate the rectangle on canvas where it is to
appear. As to how you store "state" then that depends on application. Rude and
crude would be to have all drawing to a bitmap and have OnPaint copy the
invalidated part of screen from the bitmap. In a CAD/GIS type application, you
would query your drawing/database structure to get the objects to redraw. OnPaint
handlers generally need some mechanism to look at what part of screen is 
invalid and then just needs to be redrawn. 

----------------------------------------------------------
Phil Scadden, Institute of Geological and Nuclear Sciences
PO Box 30368, Lower Hutt, New Zealand
Ph +64 4 5704821, fax +64 4 5704603
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to