Board index » delphi » Word Wrap in buttons/bitmap buttons

Word Wrap in buttons/bitmap buttons

    A (hopefully) simple question... how does one word wrap the text on a
button. I'd
like to make a couple large and have the words wrap around. Unfortunately, I
do
not see an obvious property, nor does the "C" \n in the string work. Any
help would
be greatly appreciated.

John Campbell

 

Re:Word Wrap in buttons/bitmap buttons


take a TSMButton on my site or simply write the successor TButton:

Type
  TSMButton = class (TButton)
  Private
    FWordWrap: Boolean;
    Procedure SetWordWrap (Value: Boolean);
  Protected
    Procedure CreateParams (var Params: TCreateParams); override;
  Public
    Constructor Create (AOwner: TComponent); override;
  Published
    Property WordWrap: Boolean read FWordWrap write SetWordWrap default
True;
  End;

Implementation

Constructor TSMButton. Create (AOwner: TComponent);
Begin
  Inherited Create (AOwner);
  FWordWrap: = True;
End;

Procedure TSMButton. SetWordWrap (Value: Boolean);
Begin
  If (FWordWrap < > Value) then
  Begin
    FWordWrap: = Value;
    ReCreateWnd;
  End;
End;

Procedure TSMButton. CreateParams (var Params: TCreateParams);
Begin
  Inherited CreateParams (Params);

  If FWordWrap then
    Params. Style: = Params. Style or BS _ MULTILINE
  Else
    Params. Style: = Params. Style and not BS _ MULTILINE;
End;

End.

--
With best regards, Mike Shkolnik.
FIDO: 2:463/106.14
E-Mail: mshkol...@rs-ukraine.kiev.ua
        m...@woccu.freenet.kiev.ua
WEB: http://www.geocities.com/SiliconValley/Grid/3989

John Campbell D??? ???Y?? <79tkch$g...@forums.borland.com> ...

Quote
>    A (hopefully) simple question... how does one word wrap the text on a
>button. I'd
>like to make a couple large and have the words wrap around. Unfortunately,
I
>do
>not see an obvious property, nor does the "C" \n in the string work. Any
>help would
>be greatly appreciated.

>John Campbell

Re:Word Wrap in buttons/bitmap buttons


John,
 Use a TBitBtn and set its caption at runtime.

   BitBtn1.Caption := 'Hello'#13'World';

 ---- x
==============================
Xavier Pacheco (TeamB)
xav...@xapware.com

Sorry but TeamB cannot answer support
questions received via email.

Other Threads