查看完整版本: 鼠标右击并弹出上下文菜单

tbage 2008-4-26 06:18 PM

鼠标右击并弹出上下文菜单

小弟初学au3,就是简单的读取txt的内容并列出在GUI上.
想,让鼠标右击某一行时,弹出一个上下文菜单,却不知从何下手...望高手们给支支招啊...
这里先谢过了!!!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("窗体1", 466, 425, 193, 115)
$Listview = GUICtrlCreateListview("txt内容如下", 16, 16, 313, 353)
$Button1 = GUICtrlCreateButton("读取txt内容", 120, 384, 113, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=


$exe = @ScriptDir & "\test.txt"
$file = FileOpen($exe, 0)

If $file = -1 Then
        MsgBox(0, "错误", "无法打开文本,请检查相关设置!")
        Exit
EndIf

Do
        $GUIMSG = GUIGetMsg()
        If $GUIMSG = $Button1 Then
                While 1
                        $line = FileReadLine($file)
                        If @error = -1 Then ExitLoop
                        If $line <> "" Then
                                $item1=GUICtrlCreateListViewItem($line,$listview)
                        EndIf
                        $nMsg = GUIGetMsg()
                        Switch $nMsg
                                Case $GUI_EVENT_CLOSE
                                        Exit

                        EndSwitch
                WEnd
        EndIf
Until $GUIMSG = $GUI_EVENT_CLOSE

tbage 2008-4-26 07:22 PM

有人帮帮忙吗?????????????????????
页: [1]
查看完整版本: 鼠标右击并弹出上下文菜单
Google