Sign in to follow this  
Followers 0
penggilas2

How to change menu color to the blue color..??

3 posts in this topic

how do I change the background colors in to the blue colors

when click option button then menu will be appear, I want change menu color to blue color and white font..

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $hGui, $OptionsBtn, $OptionsDummy, $OptionsContext, $OptionsCommon, $OptionsFile, $msg
    Local $OptionsExit, $HelpBtn, $HelpDummy, $HelpContext, $HelpWWW, $HelpAbout
    $hGui = GUICreate("My GUI", 170, 40, 1, 1, BitOR($WS_POPUP,$WS_BORDER))

    $OptionsBtn = GUICtrlCreateButton("&Options", 10, 10, 70, 20, $BS_FLAT)

    ; At first create a dummy control for the options and a contextmenu for it
    $OptionsDummy = GUICtrlCreateDummy()
    $OptionsContext = GUICtrlCreateContextMenu($OptionsDummy)
    $OptionsCommon = GUICtrlCreateMenuItem("Common", $OptionsContext)
    $OptionsFile = GUICtrlCreateMenuItem("File", $OptionsContext)
    GUICtrlCreateMenuItem("", $OptionsContext)
    $OptionsExit = GUICtrlCreateMenuItem("Exit", $OptionsContext)


    $HelpBtn = GUICtrlCreateButton("&Help", 90, 10, 70, 20, $BS_FLAT)

    ; Create a dummy control and a contextmenu for the help too
    $HelpDummy = GUICtrlCreateDummy()
    $HelpContext = GUICtrlCreateContextMenu($HelpDummy)
    $HelpWWW = GUICtrlCreateMenuItem("Website", $HelpContext)
    GUICtrlCreateMenuItem("", $HelpContext)
    $HelpAbout = GUICtrlCreateMenuItem("About...", $HelpContext)


    GUISetState()

    While 1
        $msg = GUIGetMsg()

        Switch $msg
            Case $OptionsExit, $GUI_EVENT_CLOSE
                ExitLoop

            Case $OptionsBtn
                ShowMenu($hGui, $msg, $OptionsContext)

            Case $HelpBtn
                ShowMenu($hGui, $msg, $HelpContext)

            Case $HelpAbout
                MsgBox(64, "About...", "GUICtrlGetHandle-Sample")
        EndSwitch
    WEnd
    GUIDelete()
EndFunc   ;==>Example2


; Show a menu in a given GUI window which belongs to a given GUI ctrl
Func ShowMenu($hWnd, $CtrlID, $nContextID)
    Local $arPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($nContextID)

    $arPos = ControlGetPos($hWnd, "", $CtrlID)

    $x = $arPos[0]
    $y = $arPos[1] + $arPos[3]

    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)
EndFunc   ;==>ShowMenu


; Convert the client (GUI) coordinates to screen (desktop) coordinates
Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $stPoint = DllStructCreate("int;int")

    DllStructSetData($stPoint, 1, $x)
    DllStructSetData($stPoint, 2, $y)

    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))

    $x = DllStructGetData($stPoint, 1)
    $y = DllStructGetData($stPoint, 2)
    ; release Struct not really needed as it is a local
    $stPoint = 0
EndFunc   ;==>ClientToScreen


; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd)
Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
EndFunc   ;==>TrackPopupMenu

Share this post


Link to post
Share on other sites



penggilas2,

Take a look at Holger's ModernMenu - it lets you set colours in menus. I have just begun playing with it myself. :)

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

penggilas2,

Take a look at Holger's ModernMenu - it lets you set colours in menus. I have just begun playing with it myself. ;)

M23

Waw.. that`s coollll... But not for beginners like me.. :)

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