In ATSynEdit component, I need to get TextExtent for a string. But even when TATSynEdit.Canvas handle is not yet allocated (HandleAllocated=False yet). I can use any other ready TCanvas, but how to get it?
- Maybe I can create temporary TCanvas and set its Handle to GetDC(0)? This is current approach and I have mem leaks with it (even with call ReleaseDC() after GetDC() ).
- Or maybe I can use some global Canvas, e.g. Application.MainForm.Canvas? Is it always ready to use?