mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 18:59:08 +02:00
LCL/TSpeedButton: Improve text alignment when there is not glyph.
This commit is contained in:
parent
8cfb1b7a3e
commit
ad41c897b7
@ -701,6 +701,8 @@ begin
|
|||||||
|
|
||||||
if Draw then
|
if Draw then
|
||||||
begin
|
begin
|
||||||
|
if not HasGlyph then
|
||||||
|
S := 0;
|
||||||
case CurLayout of
|
case CurLayout of
|
||||||
blGlyphLeft : begin
|
blGlyphLeft : begin
|
||||||
Offset.X:= M;
|
Offset.X:= M;
|
||||||
@ -736,11 +738,17 @@ begin
|
|||||||
begin
|
begin
|
||||||
Left := Left + OffsetCap.X;
|
Left := Left + OffsetCap.X;
|
||||||
Top := Top + OffsetCap.Y;
|
Top := Top + OffsetCap.Y;
|
||||||
if CurLayout = blGlyphRight then
|
case CurLayout of
|
||||||
|
blGlyphLeft: Right := Left + TextSize.CX;
|
||||||
|
blGlyphRight:
|
||||||
|
begin
|
||||||
Right := ClientSize.cx - M - GlyphWidth - S;
|
Right := ClientSize.cx - M - GlyphWidth - S;
|
||||||
|
Left := Right - TextSize.CX;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TextFlags := DT_LEFT or DT_TOP or DT_CENTER or DT_NOCLIP;
|
TextFlags := DT_TOP or DT_CENTER;
|
||||||
if UseRightToLeftReading then
|
if UseRightToLeftReading then
|
||||||
TextFlags := TextFlags or DT_RTLREADING;
|
TextFlags := TextFlags or DT_RTLREADING;
|
||||||
|
|
||||||
@ -1074,6 +1082,13 @@ var
|
|||||||
AIndex: Integer;
|
AIndex: Integer;
|
||||||
AEffect: TGraphicsDrawEffect;
|
AEffect: TGraphicsDrawEffect;
|
||||||
begin
|
begin
|
||||||
|
if (FGlyph.Glyph.Empty) and ((Images = nil) or (ImageIndex = -1)) then
|
||||||
|
begin
|
||||||
|
Result.CX := 0;
|
||||||
|
Result.CY := 0;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
FGlyph.GetImageIndexAndEffect(Low(TButtonState), Font.PixelsPerInch,
|
FGlyph.GetImageIndexAndEffect(Low(TButtonState), Font.PixelsPerInch,
|
||||||
GetCanvasScaleFactor, AImageRes, AIndex, AEffect);
|
GetCanvasScaleFactor, AImageRes, AIndex, AEffect);
|
||||||
Result.CX := AImageRes.Width;
|
Result.CX := AImageRes.Width;
|
||||||
|
Loading…
Reference in New Issue
Block a user