1. Home
  2. Computing & Technology
  3. Delphi Programming

TButton with multiline Caption

By , About.com Guide

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
  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;

{
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.
}
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Set File Date (created)
« Is Point in Polygon?

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2001 Delphi Tips
  7. TButton with multiline Caption

©2009 About.com, a part of The New York Times Company.

All rights reserved.