[Lazarus] DrawText function problems
Lee Jenkins
lee at datatrakpos.com
Sun Apr 13 01:18:15 CEST 2008
Lee Jenkins wrote:
> 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.
>
After some thought, maybe it would be better to just ask:
Is there a workable way to draw centered text onto a TImage that has an image
already assigned to it?
I thought about drawing to the bitmap first, but wanted avoid having to
create/destroy bitmap image so many times.
Thanks,
--
Warm Regards,
Lee
"When my company started out, we were really, really, really, really small.
Now...we're just really small."
More information about the Lazarus
mailing list