diff --git a/components/exctrls/examples/ButtonEx/demo.lpi b/components/exctrls/examples/ButtonEx/demo.lpi index 36355d650..3e59e3d10 100644 --- a/components/exctrls/examples/ButtonEx/demo.lpi +++ b/components/exctrls/examples/ButtonEx/demo.lpi @@ -65,6 +65,9 @@ + + + diff --git a/components/exctrls/exctrlspkg.lpk b/components/exctrls/exctrlspkg.lpk index dc2a7235f..40676a88b 100644 --- a/components/exctrls/exctrlspkg.lpk +++ b/components/exctrls/exctrlspkg.lpk @@ -42,6 +42,7 @@ + diff --git a/components/exctrls/source/exbuttons.pas b/components/exctrls/source/exbuttons.pas index ff32abd01..f1fdadc75 100644 --- a/components/exctrls/source/exbuttons.pas +++ b/components/exctrls/source/exbuttons.pas @@ -418,6 +418,7 @@ var i: integer; txtSize: TSize; txtPt: TPoint; + ts: TTextStyle; begin if (csDestroying in ComponentState) or not HandleAllocated then exit; @@ -526,7 +527,13 @@ begin end; txtPt.Y := (Height - txtSize.CY + 1) div 2; R := Rect(txtPt.X, txtPt.Y, txtPt.X + txtSize.CX, txtPt.Y + txtSize.CY); - DrawText(lCanvas.Handle, PChar(Caption), -1, R, flags); + + ts := lCanvas.TextStyle; + ts.Alignment := lAlignment; + ts.Layout := tlCenter; + ts.SingleLine := not FWordWrap; + ts.Wordbreak := FWordWrap; + lCanvas.TextRect(R, txtPt.X, txtPt.Y, Caption, ts); // Draw focus rectangle if FShowFocusRect and Focused then