error471

Context menu with colored square icons.

4 posts in this topic

Hey folks,

is it possible to easily create a context menu with colored squares? 

Best regards.

error471

contextmenu.png

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Modern Menu UDF seems to be able to manage this, but it's  developement stopped long time ago. Errors in the includes are actually making trouble.

I found a way using this example script:

#include <GuiMenu.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
$Form1 = GUICreate("Entwurf", @DesktopWidth, @DesktopHeight, -1, -1, BitOR($WS_MAXIMIZE, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_GROUP, $WS_CLIPSIBLINGS, $ES_AUTOHSCROLL, $ES_AUTOVSCROLL))
$Datei = GUICtrlCreateMenu("&Datei")
$Bearbeiten = GUICtrlCreateMenu("&Bearbeiten")
$Optionen = GUICtrlCreateMenu("&Optionen")
$Hilfe = GUICtrlCreateMenu("&Hilfe")
$oeffnen = GUICtrlCreateMenuItem("&Öffnen", $Datei)
$menuneu = GUICtrlCreateMenuItem("&Neu", $Datei)
$menudruck = GUICtrlCreateMenuItem("&Drucken", $Datei)
$menusave = GUICtrlCreateMenuItem("&Speichern", $Datei)
$hBmpCreate = _WinAPI_LoadImage(0, "s:\folder.bmp", $IMAGE_BITMAP, 16, 16, BitOR($LR_LOADTRANSPARENT, $LR_LOADFROMFILE))
_GUICtrlMenu_SetItemBitmaps(GUICtrlGetHandle($Datei), $oeffnen, $hBmpCreate, $hBmpCreate, False)
$menusearch = GUICtrlCreateMenuItem("Suchen", $Bearbeiten)
$menucopy = GUICtrlCreateMenuItem("Kopieren", $Bearbeiten)
$menutoexcel = GUICtrlCreateMenuItem("in Excel bearbeiten", $Bearbeiten)
$menusend = GUICtrlCreateMenuItem("als E-Mail versenden", $Bearbeiten)
$menueinstellungen = GUICtrlCreateMenuItem("Firmendaten aktualisieren", $Optionen)
$kommission = GUICtrlCreateMenuItem("Kommission hinzufügen", $Optionen)
$menuinfo = GUICtrlCreateMenuItem("Über...", $Hilfe)
GUISetBkColor(0xFFFFFF)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Cheers.

Edited by error471

Share this post


Link to post
Share on other sites

Thank you. Maybe there is a usage for me later.

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