Sign in to follow this  
Followers 0
dantay9

ModernMenu "border"

6 posts in this topic

#1 ·  Posted (edited)

I am using ModernMenu.au3 by Holger and the code is way over my head. I want to remove the tan border or rim around the black menu items, but I can't seem to find out how to do it.

There is more to my code than this (such as on event hovering), but this is a stripped down version of it that reproduces the problem. Here is an example of the border:

#include "ModernMenuRaw.au3"

$GUI = GUICreate("Gecko Web Browser", 700, 50)

#Region Create Context Menu
_SetMenuBkColor(0x000000)
_SetMenuIconBkColor(0x000000)
_SetMenuTextColor(0xFFFFFF)
_SetMenuSelectBkColor(0xBD4908) ;rgb = 0x0849BD
_SetMenuSelectTextColor(0xFFFFFF)

$GUIContextMenu = GUICtrlCreateMenu("File")
_GUICtrlCreateODMenuItem("Exit", $GUIContextMenu)
#EndRegion Create Context Menu

GUISetState(@SW_SHOW, $GUI)

While 1
    $Msg = GUIGetMsg()

    Switch $Msg
        Case -3
            Exit
    EndSwitch
WEnd

Can someone wade through this script and tell me where I can fix this?

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites



*bump*

I would like a completely black menu item. Is there a way to remove the border, or is the border automatically there on every menu item?


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I did find out that I can use _WinAPI_SetSysColors($COLOR_MENU, 0) to adjust the menu to the color that I want. Sadly, this adjusts all menus, not just the menu I want. I guess I could switch the menu colors back and forth depending on whether or not the correct window is active. Is this the only way, or is there some way to set the menu background color for a specific menu to black since it is ownerdrawn?

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I found a temporary fix for the problem. It works, but isn't pretty.

Global Const $OriginalMenuColor = _WinAPI_GetSysColor($COLOR_MENU)

Func WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam)
    If $hWnd = $GUI Then
        If $wParam = 0x00000000 Then
            _WinAPI_SetSysColors($COLOR_MENU, $OriginalMenuColor) ;change menu color to system color
        ElseIf $wParam = 0x00000001 Then
            _WinAPI_SetSysColors($COLOR_MENU, 0) ;change menu color to black
        EndIf
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc

Func OnAutoItExit()
    _WinAPI_SetSysColors($COLOR_MENU, $OriginalMenuColor) ;change menu color to system color
EndFunc

If someone finds a way to change the color of a specific menu, please tell me.

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

This will set all the items of a sub-menu but I have nothing to set individual menu items.

Func _Menu_SetColor($hMenuid,$hColor)
   Local $Hmenu = GUICtrlGetHandle ($hMenuid)
   Local $Hbrush = DllCall ("gdi32.dll", "hwnd", "CreateSolidBrush", "int", $hColor)
   $Hbrush = $Hbrush[0]
   Local $Stmenuinfo = DllStructCreate ("dword;dword;dword;uint;dword;dword;ptr")
   DllStructSetData ($Stmenuinfo, 1, DllStructGetSize ($Stmenuinfo))
   DllStructSetData ($Stmenuinfo, 2, BitOr (0x80000000, 0x00000002))
   DllStructSetData ($Stmenuinfo, 5, $Hbrush)
   DllCall ("user32.dll", "int", "SetMenuInfo", "hwnd", $Hmenu, "ptr", DllStructGetPtr ($Stmenuinfo))
   $Stmenuinfo = 0
EndFunc    ;<===> _Menu_SetColor()

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

That works great. I just needed a way to remove the border on the menus for a single menu bar. Thank you very much!


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

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