Here is a working example of changing a TButton between single line and multi-line.
All you need is a form with a TButton and a Scrollbar (min=0 max=1)
Sorry for the non-standard formatting. Also; I am only a hobbyist and this
technique may be scorned by the experts here... Oh well!
Procedure TForm1.Multiline(H:HWND);
var
Style: DWORD;
begin
Style := GetWindowLongPtr(H, GWL_STYLE);
if Boolean(ScrollBar1.Position)
then Style := Style or BS_MULTILINE
else Style := Style and not BS_MULTILINE;
SetWindowLongPtr(H, GWL_STYLE, Style);
Button1.SetFocus;
end;
Procedure TForm1.Button1Click(Sender:TObject);
var
x:integer;
Tot:integer=0;
T:integer=0;
S:String='';
begin
Multiline(Button1.Handle);
For x:= 0 to 7 do
Begin
Tot:=Tot+Round(intpower(2,x));;
S:=S+inttostr(T) + ' ';
end;
Button1.Caption:=S + #10 + '=' + inttostr(Tot);
end;