mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-25 16:49:04 +02:00
LCL/SpeedButton: Draw centered multi-line caption. Issue #39632
This commit is contained in:
parent
932d36f20e
commit
89bd5e8943
@ -711,19 +711,19 @@ begin
|
||||
blGlyphRight : begin
|
||||
Offset.X:= ClientSize.cx - M - GlyphWidth;
|
||||
Offset.Y:= (ClientSize.cy - GlyphHeight) div 2;
|
||||
OffsetCap.X:= Offset.X - S - TextSize.cx;
|
||||
OffsetCap.X:= M;
|
||||
OffsetCap.Y:= (ClientSize.cy - TextSize.cy) div 2;
|
||||
end;
|
||||
blGlyphTop : begin
|
||||
Offset.X:= (ClientSize.cx - GlyphWidth) div 2;
|
||||
Offset.Y:= M;
|
||||
OffsetCap.X:= (ClientSize.cx - TextSize.cx) div 2;
|
||||
OffsetCap.X:= 0;
|
||||
OffsetCap.Y:= Offset.Y + GlyphHeight + S;
|
||||
end;
|
||||
blGlyphBottom : begin
|
||||
Offset.X:= (ClientSize.cx - GlyphWidth) div 2;
|
||||
Offset.Y:= ClientSize.cy - M - GlyphHeight;
|
||||
OffsetCap.X:= (ClientSize.cx - TextSize.cx) div 2;
|
||||
OffsetCap.X:= 0;
|
||||
OffsetCap.Y:= Offset.Y - S - TextSize.cy;
|
||||
end;
|
||||
end;
|
||||
@ -732,13 +732,15 @@ begin
|
||||
|
||||
if FShowCaption and (Caption <> '') then
|
||||
begin
|
||||
with PaintRect, OffsetCap do
|
||||
with PaintRect do
|
||||
begin
|
||||
Left := Left + X;
|
||||
Top := Top + Y;
|
||||
Left := Left + OffsetCap.X;
|
||||
Top := Top + OffsetCap.Y;
|
||||
if CurLayout = blGlyphRight then
|
||||
Right := ClientSize.cx - M - GlyphWidth - S;
|
||||
end;
|
||||
|
||||
TextFlags := DT_LEFT or DT_TOP;
|
||||
TextFlags := DT_LEFT or DT_TOP or DT_CENTER or DT_NOCLIP;
|
||||
if UseRightToLeftReading then
|
||||
TextFlags := TextFlags or DT_RTLREADING;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user