Newline character in caption of button

Viewed 16356

I am building an application in which I want to display a button on a form. I want to display the Caption of the button on two lines. I have tried using the following code in the form's OnCreate event but it is not showing the new line.

Button.Caption := 'Hello' + #13#10 + 'world';

Any other method to add a new line?

7 Answers

In case you want to see to see the change in IDE, at design time, you can do the following:

  1. Right click in the control and select "View as Text".
  2. Locate the control and at the spot you want the line break, add to the value of Caption, the characters '#13#10' (CRLF).
  3. Right click and select "View as Form".
  4. Check the property WordWrap of the button control.
Related