[Lazarus] DrawText function problems

Lee Jenkins lee at datatrakpos.com
Sun Apr 13 00:44:15 CEST 2008


Lee Jenkins wrote:
> 
> Hi all,
> 
> I'm having a problem with drawing text on an image using the DrawText 
> function where the area around the text masked out.  Please see the 
> attached image.
> 
> This same routine works perfectly in Delphi.  Maybe the 
> Canvas.Brush.Style := bsClear is not working?
> 
> procedure TMyImage.DrawCaption;
> var
>   lRect: TRect;
> begin
>   // setup rect
>   lRect.Left := 10;
>   lRect.Top := 10;
>   lRect.Right := Width -10;
>   lRect.Bottom := Height -10;
>   //Canvas.Pen.Style := psClear; // <-- tried this as well
>   Canvas.Font.Assign(FButtonFont);
>   Canvas.Brush.Style := bsClear;
>   DrawText(Canvas.Handle, PChar(FCaption), -1, lRect,
>     DT_WORDBREAK or DT_VCENTER or DT_CENTER or DT_END_ELLIPSIS);
> end;
> 

As a follow up, Canvas.TextRect() works, but the output is terrible.  See 
attached image.

-- 

Warm Regards,

Lee

"When my company started out, we were really, really, really, really small.
Now...we're just really small."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lazarus_rendering.png
Type: image/png
Size: 10853 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20080412/9c0c3966/attachment-0007.png>


More information about the Lazarus mailing list