Jump to content
Sign in to follow this  
mike

change color

Recommended Posts

mike

how to change the GUI color the same with the picture below with/or without Xskin ?

post-43673-1231782060_thumb.jpg

Share this post


Link to post
Share on other sites
Melba23

@mike,

Start by looking at the following in the help file: GUISetBkColor, GUICtrlSetBkColor and GUICtrlSetColor. Then you might like to look at _WinAPI_SetSysColors.

If you run into trouble, post your code!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
mike

thanks Melba...

Share this post


Link to post
Share on other sites
ss3vegeta

I don't mean to hijack someone else's thread but this seams an appropriate question to follow up with. I'm got this code from the help file:

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $aElements[2] = [$COLOR_ACTIVECAPTION, $COLOR_GRADIENTACTIVECAPTION]
  ; Red and Yellow
    Local $aColors[2] = [255, 65535], $aSaveColors[2]
    GUICreate("My GUI", 300, 200)

    $aSaveColors[0] = _WinAPI_GetSysColor($COLOR_ACTIVECAPTION)
    $aSaveColors[1] = _WinAPI_GetSysColor($COLOR_GRADIENTACTIVECAPTION)

    _WinAPI_SetSysColors($aElements, $aColors)
    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd

    GUIDelete()

    _WinAPI_SetSysColors($aElements, $aSaveColors)

    Exit

EndFunc ;==>_Main

I guess I'm wondering if this will only work on XP when the theme is set to Classic? It works fine on classic but when I switch to the XP theme it doesn't work. Any advice?

Thanks

ss3

Edited by ss3vegeta

Share this post


Link to post
Share on other sites
martin

I don't mean to hijack someone else's thread but this seams an appropriate question to follow up with. I'm got this code from the help file:

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $aElements[2] = [$COLOR_ACTIVECAPTION, $COLOR_GRADIENTACTIVECAPTION]
 ; Red and Yellow
    Local $aColors[2] = [255, 65535], $aSaveColors[2]
    GUICreate("My GUI", 300, 200)

    $aSaveColors[0] = _WinAPI_GetSysColor($COLOR_ACTIVECAPTION)
    $aSaveColors[1] = _WinAPI_GetSysColor($COLOR_GRADIENTACTIVECAPTION)

    _WinAPI_SetSysColors($aElements, $aColors)
    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd

    GUIDelete()

    _WinAPI_SetSysColors($aElements, $aSaveColors)

    Exit

EndFunc;==>_Main

I guess I'm wondering if this will only work on XP when the theme is set to Classic? It works fine on classic but when I switch to the XP theme it doesn't work. Any advice?

Thanks

ss3

With XP themes on Windows decides how thgings are done. You need to turn XP themes off before you create whatever you want to be different.

#include <GuiConstants.au3>
#include <windowsconstants.au3>
Global $XS_n
XPStyleToggle(1);turn xp themes off
$Gui = GuiCreate("Test")
GUISetBkColor(0xa9a9a8)

XPStyleToggle(0);trun xp themes back on
$RadioButton = GUICtrlCreateRadio("Text", 20, 40, 40)
GUICtrlCreateGroup("group 1",10,60,300,200)

GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlCreateLabel("",20,70,300,50,$WS_CLIPSIBLINGS)
GUICtrlSetBkColor(-1,0xffff00)
;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

GUISetState()
GUISetBkColor(0xffff00)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func XPStyleToggle($OnOff = 1)
    If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0
     
    If $OnOff Then
       $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc

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
ss3vegeta

With XP themes on Windows decides how thgings are done. You need to turn XP themes off before you create whatever you want to be different.

#include <GuiConstants.au3>

Global $XS_n

Func XPStyleToggle($OnOff = 1)
    If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0
     
    If $OnOff Then
       $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf IsArray($XS_n) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
        $XS_n = ""
        Return 1
    EndIf
    Return 0
EndFunc
Thanks Martin!

Great tip. I hope you don't mind but I've actually just incorporated your function into my program.

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  

×