VCL Delphi

{
The next procedure sets Captions
on all TButton Controls
on a given Parent to be multi-lined.
}
procedure SetMultiLineButton(AParent: TWinControl);
var i : integer;
ah : THandle;
begin
for i := 0 to AParent.ControlCount - 1 do
if (AParent.Controls[i] is TButton) then
begin
ah := (AParent.Controls[i] as TButton).Handle;
SetWindowLong(ah, GWL_STYLE,
GetWindowLong(ah, GWL_STYLE) OR
BS_MULTILINE);
end;
end;
{
usage: suppose there is a
Button1 and Button2 on Form1,
Button3 and Button4 on Panel1 on Form1
by calling the next line
SetMultiLineButton(Panel1)
only Button3 and Button4 will have
multi-lined caption.
}