Jump to content

How to draw a column of text on a button?


Recommended Posts

Hi,

I was using GUICtrlCreateButton() to draw an onscreen keyboard, in which every button stands for a key. Usually the key "1" has "!" in the upper side and "1" in the bottom. So I tried:

$KEY_1 = GUICtrlCreateButton("!"&@CRLF&"1", ...)

But it didn't work. Actually it showed just "!1". Could someone please tell me how to make it work or some better ways to draw an onscreen keyboard? Thank you!

Link to comment
Share on other sites

You have to add the Style

$BS_MULTILINE 0x2000 Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

You have to add the Style

$BS_MULTILINE 0x2000 Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.

Yes, it works! Here's the code:

$KEY_1 = GUICtrlCreateButton(" !    1", ...)
    GUICtrlSetStyle($KEY_1, $BS_MULTILINE)

Thank you!

Link to comment
Share on other sites

Yes, it works! Here's the code:

$KEY_1 = GUICtrlCreateButton(" !    1", ...)
    GUICtrlSetStyle($KEY_1, $BS_MULTILINE)

Thank you!

Just got it, a better way:

$KEY_1 = GUICtrlCreateButton("!" & @CRLF     & "1", ...)
    GUICtrlSetStyle($KEY_1, $BS_MULTILINE)

Thank you!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...