EtheaDev / StyledComponents

Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations!
Apache License 2.0
152 stars 34 forks source link

Wrap the Button Text #2

Closed hraztan closed 1 year ago

hraztan commented 1 year ago

Hi. I just started fiddling with StyledComponents. Great work!! Is there any way to wrap the button text?

carloBarazzetta commented 1 year ago

Currently, button text is rendered into: procedure TStyledGraphicButton.DrawText( I'm using Winapi.Windows.DrawText(

hraztan commented 1 year ago

I achieved the desired result by adding DT_WORDBREAK and DT_CENTER to the "Flag" parameter when calling the "CanvasDrawText" procedure in the "TStyledGraphicButton.DrawText" procedure.

CanvasDrawText(Canvas, AText, R, AFlags or DT_CALCRECT or DT_WORDBREAK or DT_CENTER);

CanvasDrawText(Canvas, AText, R, AFlags or DT_WORDBREAK or DT_CENTER);