penggilas2 Posted November 26, 2009 Share Posted November 26, 2009 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.. expandcollapse popup#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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 26, 2009 Moderators Share Posted November 26, 2009 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
penggilas2 Posted November 27, 2009 Author Share Posted November 27, 2009 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.. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now