Jump to content

[Solved]colouring a checkbox


Recommended Posts

hello all,

How do you make a coloured checkbox in autoit?

I've tried to make one by making a checkbox and a label... but I think there must be a better way to do it....

Help file:

'Checkbox, Radio, Group or Progress controls cannot be painted if the "Windows XP/Vista style" is used.'

Sucessed code:

#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)

$GUI = GUICreate("")

GUISetBkColor ( 0x003300 , $GUI );Dark green

$Checkbox = GUICtrlCreateCheckbox ("",20,20,15,15)
$Label = GUICtrlCreateLabel("I'm a label.",40,20)
GUICtrlSetColor ( $Label , 0xFFCC33);orange

GUICtrlSetOnEvent($label,"OnEvent_Label")
GUISetState(@SW_SHOW)

While 1
    sleep(100)
WEnd

Func OnEvent_Label()
    If GUICtrlRead ($Checkbox) = $GUI_CHECKED Then 
        GUICtrlSetState($Checkbox,$GUI_UNCHECKED)
    Else
        GUICtrlSetState($Checkbox,$GUI_CHECKED)
    EndIf
EndFunc

Failed Code:

GUICreate("")

$Checkbox = GUICtrlCreateCheckbox ('Shortcut on Desktop',20,20)
GUICtrlSetColor ( $Checkbox , 0xFFCC33);orange
    
GUISetState(@SW_SHOW)

While 1
    sleep(100)
WEnd
Edited by MiserableLife
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...