The next procedure sets Captions on all TButton Controls on a given Parent to be multi-lined...
procedure SetMultiLineButton(AParent: TWinControl) ;
var
___j : integer;
___ah : THandle;
begin
___for j := 0 to AParent.ControlCount - 1 do
___begin
______if (AParent.Controls[j] is TButton) then
______begin
_________ah := (AParent.Controls[j] as TButton).Handle;
_________SetWindowLong(ah, GWL_STYLE,GetWindowLong(ah, GWL_STYLE) OR BS_MULTILINE) ;
______end;
___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.
}
~~~~~~~~~~~~~~~~~~~~~~~~~
No comments:
Post a Comment