Hi,
found a strange behaviour of DrawText, which
clips the last line, see attached image.
img_FormPaint2.png
Problem better displayed if r2 is removed.
img_without-r2.png
Code is coming from
https://itecnote.com/tecnote/delphi-calculating-size-of-text-before-drawing-to-a-canvas/, where we can see a nice window
img_SourceDrawText.png
, and adapted for Lazarus with
and adding
LCLIntf, LCLType,
in the uses section (by the way, what to do to have a new project skeleton which always include these two units in the uses declaration ? Thx).
17 in the title bar is coming from :
h := DrawText(Canvas.Handle,
PChar(S[i]),
Length(S[i]),
r,
Aligns[Odd(i)] or DT_WORDBREAK or DT_CALCRECT);
Caption := IntToStr(h);
and I don't know what's happens, but the line "Glad to hear that!" is 15 px height...
So the bottom of the "y" in the green top-right text is also broken.
If I enlarge Form1, the second line of the first blue text is concerned, but less than third line when present.
If I reduce Form1.Width, it's a disaster.
img_four-lines.png
(end of text in following post, due to number of images)...