Sign in to follow this  
Followers 0
Schlumpf

Textcolor on Buttons

6 posts in this topic

Moin,

is it possible to make a XPstyle-Button with a red text?


[CENTER]Sorry for my bad English... ;)[/CENTER]

Share this post


Link to post
Share on other sites



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

#3 ·  Posted (edited)

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
Opt("GUIOnEventMode",1)
Dim $mylabel = GUICtrlCreateLabel ("Testing, one two three", 2, 2, 350,35, BitOR($BS_DEFPUSHBUTTON, $SS_SUNKEN, $BS_CENTER, $SS_LEFT), $SS_BLACKFRAME)
GUICtrlSetColor(-1,0x082BFE);blue
GUICtrlSetFont(-1,14,4,"","Arial")
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
    Sleep(10000)
Wend


Func _TestButton()
    $count = 1
    While _IsPressed('01')
        If $count = 1 Then
            GUICtrlSetColor($mylabel,0xF8FA6F);blue
            GUICtrlSetFont($mylabel,14,4,"","Arial")
            GUICtrlSetBkColor($mylabel,0x082BFE); Yellow
            $count = $count + 1
        EndIf
    WEnd
    GUICtrlSetColor($mylabel,0x082BFE);blue
    GUICtrlSetFont($mylabel,14,4,"","Arial")
    GUICtrlSetBkColor($mylabel,0xF8FA6F); Yellow
EndFunc

Func ExitNow()
    Exit
EndFunc

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
EndFunc
Edited by dabus

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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!

http://www.autoitscript.com/forum/index.php?showtopic=33230

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

I'm trying to do this: Posted Image

is it possible?


[CENTER]Sorry for my bad English... ;)[/CENTER]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Yes:

http://www.autoitscript.com/forum/index.php?showtopic=25077

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  
Followers 0