[Lazarus] DrawText function problems

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sun Apr 13 04:15:03 CEST 2008


On Sat, Apr 12, 2008 at 8:18 PM, Lee Jenkins <lee at datatrakpos.com> wrote:
>  Is there a workable way to draw centered text onto a TImage that has an image
>  already assigned to it?

You could just put a label on top of it.

I would usually go for either having a fully custom drawn component,
where I manage all paint, like here:

http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Create_a_custom_control_which_draws_itself

Or, if using a TImage, try to put a label on top of it. I've never
needed to draw to the canvas of a TImage, because I usually use
TCustomControl descendents for complex drawing, but there are
instructions here:

http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Draw_to_a_TImage

>  I thought about drawing to the bitmap first, but wanted avoid having to
>  create/destroy bitmap image so many times.

Then cache the TBitmap in the creation of your form and free on it's
destruction.

-- 
Felipe Monteiro de Carvalho



More information about the Lazarus mailing list