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."

<<inline: lazarus_rendering.png>>

_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to