使用png窗体的时候,怎么写右键菜单?
png窗体很漂亮,可以更换各种图片。但是想在窗体上单击鼠标右键就弹出快捷菜单,试了好久都没成功,请高手指点! 试试 _GUICtrlMenu_TrackPopupMenu LS正解了 给LZ个例子#include <GuiMenu.au3>#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Global Enum $idOpen = 1000, $idSave, $idInfo
_Main()
Func _Main()
; Create GUI
GUICreate("Menu", 400, 300)
GUISetState()
; Register message handlers
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
; Handle WM_COMMAND messages
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $ilParam
Switch $iwParam
Case $idOpen
_WinAPI_ShowMsg("Open")
Case $idSave
_WinAPI_ShowMsg("Save")
Case $idInfo
_WinAPI_ShowMsg("Info")
EndSwitch
EndFunc ;==>WM_COMMAND
; Handle WM_CONTEXTMENU messages
Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $ilParam
Local $hMenu
$hMenu = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen)
_GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave)
_GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
_GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo)
_GUICtrlMenu_TrackPopupMenu($hMenu, $iwParam)
_GUICtrlMenu_DestroyMenu($hMenu)
Return True
EndFunc ;==>WM_CONTEXTMENU
谢谢楼上的二位,_GUICtrlMenu_InsertMenuItem我之前也试过,在
GUICreate("Menu", 400, 300)
这样创建的窗体上可行,但是在
$PNG_GUI = CreateTransparentGUI("PNG图片显示(透明)","Background1.png",1,240,0,100,-1,-1)
这样创建的png窗体上不行。 学习一下,我的金币就够了。哇哈哈 谢谢各位高手! 學習一下,把它導入到快閃視窗來{:face (356):} 学习啦…… 学习啦……
页:
[1]