Jump to content

How can I change menu text color?


cobainer
 Share

Recommended Posts

I think ModernMenu is what you're looking, for, but I'm not sure. Look at page.

Edited by AppTux
PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

I think ModernMenu is what you're looking, for, but I'm not sure. Look at page.

Thank you for your reply. I already checked Modernmenu. But what I exactly want is the top menu text color. Even Modernmenu coudn't change the top one. I mean main menu bar.

Link to comment
Share on other sites

I've got some hints.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Menus do not have a settiing for text color - the color is controlled

only by the system-wide theme settings. However, you can take control

of your menu text colors if you are willing to custom draw everything

about the menu. That would require a menu with the "owner draw" style.

You can look that up in MSDN, and I recall there is an example in Petzold.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-

Link to comment
Share on other sites

I've got some hints.

Do you want a complicated solution?

One way to make it appear as if it is the Title would be to create a second frameless gui on top of the Title with its own colour and text.

The other way would be to create a frameless Gui and use the top section as your Tiltle.

Like so:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
Opt('MustDeclareVars', 1)
Example1()
Func Example1()
    Local $msg
    GUICreate("My GUI",100,100,10,10,$ws_popup) ; will Remove frame
    GUICtrlCreateLabel("My Title",0,0,100,20);Label Inside Top section
    GUICtrlSetColor(-1, 0xff0000)
    GUICtrlSetBkColor(-1, 0x00ff00)
    GUISetState(@SW_SHOW)
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()
EndFunc   ;==>Example1
Link to comment
Share on other sites

Thank you for your reply. I already checked Modernmenu. But what I exactly want is the top menu text color. Even Modernmenu coudn't change the top one. I mean main menu bar.

In that case I think it is not so difficult. All you have to do is have a label for each main menu item, and for each label have a context menu. When the label for the main menu is clicked you can change its colour and its background colour.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <winapi.au3>
Example1()
Func Example1()
   Local $msg
   $hWnd = GUICreate("My GUI");,100,100,10,10,$ws_popup) ; will Remove frame
   $lmenu1 = GUICtrlCreateLabel(" File ", 15, 4)
    GUICtrlSetBkColor(-1, 0x999999)
   GUICtrlSetColor(-1, 0xffffff)
   GUICtrlSetFont(-1,9,800)
   $lmenu2 = GUICtrlCreateLabel(" Help ", 45, 4)
    GUICtrlSetFont(-1,9,800)
   GUICtrlSetBkColor(-1, 0x999999)
   GUICtrlSetColor(-1, 0x0000ff)
   GUICtrlCreateLabel("", 0, 0, 400, 25, $WS_CLIPSIBLINGS)
   GUICtrlSetBkColor(-1, 0x999999)
   $HelpDummy = GUICtrlCreateDummy()
   $contextmenu = GUICtrlCreateContextMenu($HelpDummy)
   $HelpDummy2 = GUICtrlCreateDummy()
   $contextmenu2 = GUICtrlCreateContextMenu($HelpDummy2)
   GUISetState(@SW_SHOW)
   $newsubmenu = GUICtrlCreateMenu("new", $contextmenu)
   $textitem = GUICtrlCreateMenuItem("text", $newsubmenu)
   $fileitem = GUICtrlCreateMenuItem("Open", $contextmenu)
   $saveitem = GUICtrlCreateMenuItem("Save", $contextmenu)
   $infoitem = GUICtrlCreateMenuItem("Info", $contextmenu)
   GUICtrlCreateMenuItem("", $contextmenu) ; separator
   $menuHelp = GUICtrlCreateMenuItem("About", $contextmenu2)
   Global $pt = DllStructCreate("int;int")
   While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $lmenu1
            showmenu($hWnd, $contextmenu, $lmenu1, 0x0000ff, 0x999999)
        Case $lmenu2
            showmenu($hWnd, $contextmenu2, $lmenu2, 0xfbbbb00, 0x999999)
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
   WEnd
   GUIDelete()
EndFunc   ;==>Example1

Func showmenu($hW, $cMenu, $menuIt, $BkCol1, $BkCol2)
   Local $pt = DllStructCreate("int;int")
   Local $Pos = ControlGetPos($hW, "", $menuIt)
   If Not IsArray($Pos) Then Return
   
   DllStructSetData($pt, 1, $Pos[0])
   DllStructSetData($pt, 2, $Pos[1] + $Pos[3])
   _WinAPI_ClientToScreen($hW, $pt)
   GUICtrlSetBkColor($menuIt, $BkCol1)
   TrackPopupMenu($hW, GUICtrlGetHandle($cMenu), DllStructGetData($pt, 1), DllStructGetData($pt, 2))
   GUICtrlSetBkColor($menuIt, $BkCol2)
EndFunc   ;==>showmenu

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

It needs sorting out but it gives the general idea.

Edit.- Improved example a bit.

Edited by martin
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.
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...