Mega Code Archive

 
Categories / Delphi / Examples
 

How to show more than one line on a Button

Title: How to show more than one line on a Button. Question: How can I show more then one line on a Button, and even center these lines Answer: In the OnCreate of your form you can use: procedure TForm1.FormCreate(Sender: TObject); begin //Button: SetWindowLong(Button1.Handle, GWL_STYLE, GetWindowLong(Button1.Handle, GWL_STYLE) or BS_MULTILINE); Button1.Caption := 'This is'#13'a Button'#13'test'; //BitBtn: SetWindowLong(BitBtn1.Handle, GWL_STYLE, GetWindowLong(BitBtn1.Handle, GWL_STYLE) or BS_MULTILINE); BitBtn1.Caption := 'This is'#13'a'#13'BitBtn test'; end; The Button has a LeftAlignment, the BitBtn Centers