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