mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-08 16:25:56 +02:00
lcl: safer gdi handles typecasting
git-svn-id: trunk@15219 -
This commit is contained in:
parent
41a290891d
commit
aeaaaf25d5
@ -40,7 +40,7 @@ begin
|
|||||||
DC := GetDC(Parent.Handle);
|
DC := GetDC(Parent.Handle);
|
||||||
try
|
try
|
||||||
R := Rect(0, 0, Width, Height);
|
R := Rect(0, 0, Width, Height);
|
||||||
OldFont := SelectObject(DC, Font.Reference.Handle);
|
OldFont := SelectObject(DC, HGDIOBJ(Font.Reference.Handle));
|
||||||
Flags := DT_CALCRECT or DT_EXPANDTABS;
|
Flags := DT_CALCRECT or DT_EXPANDTABS;
|
||||||
if WordWrap then
|
if WordWrap then
|
||||||
inc(Flags, DT_WORDBREAK)
|
inc(Flags, DT_WORDBREAK)
|
||||||
@ -338,7 +338,7 @@ begin
|
|||||||
and (CurFontHeight<=MaxFontHeight) do begin
|
and (CurFontHeight<=MaxFontHeight) do begin
|
||||||
AFont.Height:=CurFontHeight; // NOTE: some TFont do not allow any integer
|
AFont.Height:=CurFontHeight; // NOTE: some TFont do not allow any integer
|
||||||
//debugln('TCustomLabel.CalcFittingFontHeight A ',dbgs(MinFontHeight),'<=',dbgs(AFont.Height),'<=',dbgs(MaxFontHeight));
|
//debugln('TCustomLabel.CalcFittingFontHeight A ',dbgs(MinFontHeight),'<=',dbgs(AFont.Height),'<=',dbgs(MaxFontHeight));
|
||||||
OldFont := SelectObject(DC, AFont.Reference.Handle);
|
OldFont := SelectObject(DC, HGDIOBJ(AFont.Reference.Handle));
|
||||||
DrawText(DC, PChar(TheText), Length(TheText), R, Flags);
|
DrawText(DC, PChar(TheText), Length(TheText), R, Flags);
|
||||||
SelectObject(DC, OldFont);
|
SelectObject(DC, OldFont);
|
||||||
NeededWidth := R.Right - R.Left;
|
NeededWidth := R.Right - R.Left;
|
||||||
|
Loading…
Reference in New Issue
Block a user