找回密码
 加入
搜索
查看: 2650|回复: 3

[AU3基础] 关于_GUICtrlListView_Create控件右键菜单如何创建(已解决)

[复制链接]
发表于 2011-4-7 14:13:05 | 显示全部楼层 |阅读模式
本帖最后由 shenrenba 于 2011-4-7 16:12 编辑

使用_GUICtrlListView_Create创建的控件 用GUICtrlCreateContextMenu 无效
使用GUICtrlCreateListView 创建的就可以  请问如何解决
#include <GuiListView.au3>
$hGUI = GUICreate("Test", 400, 300)
$hListView = _GUICtrlListView_Create($hGUI, "", 30, 20, 340, 50, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_GRIDLINES)
_GUICtrlListView_InsertColumn($hListView, 0, "1", 50)
_GUICtrlListView_InsertColumn($hListView, 1, "2", 50)
_GUICtrlListView_InsertColumn($hListView, 2, "3", 100)
$ListView =GUICtrlCreateListView("1  |2  |3   ",30, 100, 340, 50)
$hmenu = GUICtrlCreateContextMenu($hListView)
GUICtrlCreateMenuItem("ceshi1", $hmenu)
$menu = GUICtrlCreateContextMenu($ListView)
GUICtrlCreateMenuItem("ceshi2", $menu)
GUISetState()
While GUIGetMsg() <> -3
WEnd
发表于 2011-4-7 14:35:27 | 显示全部楼层
我不明白,既然如此,那用GUICtrlCreateListView来创建控件不就好了,GUICtrlCreateListView创建的控件同样可以使用_GUICtrlListView_的相关函数呀。
另外回答你的问题,直接创建菜单如果不行的话,可以绕一下,通过Dummy控件来绑定菜单控件,然后注册个WM_NOTIFY消息,定位ListView控件,如果鼠标点击右键的消息发生在此控件下,则弹出创建的菜单,弹出菜单可以使用dllcall函数调用user32.dll中的TrackPopupMenuEx

评分

参与人数 1金钱 +10 收起 理由
shenrenba + 10

查看全部评分

发表于 2013-7-18 12:38:47 | 显示全部楼层
$hListview1 = GUICtrlCreateListView
$hListview=GUICtrlGetHandle($hListview1)是等于_GUICtrlListView_Create创建的句柄的·
发表于 2013-7-18 12:38:48 | 显示全部楼层
$hListview1 = GUICtrlCreateListView
$hListview=GUICtrlGetHandle($hListview1)是等于_GUICtrlListView_Create创建的句柄的·
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-29 01:31 , Processed in 0.079532 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表