Jump to content
Sign in to follow this  

Textcolor on Buttons

Recommended Posts

It's shown in the help file as an example for GUIRegisterMsg.

You could also make your own image and use it as a button, but you might need 2 images so that the depressed state can be shown as well.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post

Link to post
Share on other sites

Not tested, but SmOke_N posted this, so it should be ok...

Please use the search... +color +button has some hits :)

#include <GUIConstants.au3>

GUICreate("Label disguised as a button"); will create a dialog box that when displayed is centered
Dim $mylabel = GUICtrlCreateLabel ("Testing, one two three", 2, 2, 350,35, BitOR($BS_DEFPUSHBUTTON, $SS_SUNKEN, $BS_CENTER, $SS_LEFT), $SS_BLACKFRAME)
GUICtrlSetBkColor(-1,0xF8FA6F); Yellow
GUICtrlSetOnEvent($mylabel, "_TestButton")
GUISetOnEvent(- 3, 'ExitNow')
GUISetState () ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1

Func _TestButton()
    $count = 1
    While _IsPressed('01')
        If $count = 1 Then
            GUICtrlSetBkColor($mylabel,0x082BFE); Yellow
            $count = $count + 1
    GUICtrlSetBkColor($mylabel,0xF8FA6F); Yellow

Func ExitNow()

Func _IsPressed($s_hexKey, $v_dll = 'user32.dll')
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
Edited by dabus

Share this post

Link to post
Share on other sites

might want to take a look at _ControlHover()

Function Name:    _ControlHover()
; Description:      Enable Mouse/Hover Over Control Events
;                    Find if Mouse is over a known control
;                    Find if a Mouse has Clicked on a known control

has a great demo too!



Edited by Valuater


Share this post

Link to post
Share on other sites



Well, kind of. XPstyle makes it impossible to do it the way you'd like. But you can get red text on a button, it just kind of sucks thanks to Microsoft.

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...