找回密码
 加入
搜索
查看: 1552|回复: 0

[AU3基础] 在ListView滚动显示未显示完的Label,谢谢!

[复制链接]
发表于 2013-3-26 14:41:24 | 显示全部楼层 |阅读模式
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
$Gui = GUICreate("test", 500, 550)

Dim $Label[256]
$h = 30
$s = 30

For $i = 1 To 255

        $Label[$i] = GUICtrlCreateLabel($i, $h, $s, 30, 20, $WS_BORDER)
        GUICtrlSetBkColor(-1, 0xA6CAF0)
        $h = $h + 40
        If $h > 450 Then
                $h = 30
                $s = $s + 30
        EndIf
       
Next
$hListView = GUICtrlCreateListView("", 10, 0, 470, 550)
$DummyMenu = GUICtrlCreateDummy()
$ContextMenu = GUICtrlCreateContextMenu($DummyMenu)
$MenuItem1 = GUICtrlCreateMenuItem("菜单1", $ContextMenu)
$MenuItem2 = GUICtrlCreateMenuItem("菜单2", $ContextMenu)
GUICtrlCreateMenuItem("", $ContextMenu)
$ExitMenuItem = GUICtrlCreateMenuItem("退出", $ContextMenu)
GUISetState()


While 1
        $CurInfo = GUIGetCursorInfo($Gui)
        $Msg = GUIGetMsg()
        Select
                Case $Msg = -3
                        Exit
                Case $CurInfo[3] = 1 And $CurInfo[4] = $Label[1]
                        ShowMenu($Gui, $ContextMenu)
                Case $CurInfo[3] = 1 And $CurInfo[4] = $Label[2]
                        ShowMenu($Gui, $ContextMenu)
                Case $CurInfo[3] = 1 And $CurInfo[4] = $Label[3]
                        ShowMenu($Gui, $ContextMenu)                       
                Case $Msg = $ExitMenuItem
                        Exit
                Case $Msg =$MenuItem1
                        MsgBox(0,0,GUICtrlRead($Label[1]))
                       
                       
        EndSelect
WEnd
; Show a menu in a given GUI window which belongs to a given GUI ctrl
Func ShowMenu($hWnd, $nContextID)
        Local $hMenu = GUICtrlGetHandle($nContextID)
        $arPos = MouseGetPos()
        Local $x = $arPos[0]
        Local $y = $arPos[1]
        DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
EndFunc   ;==>ShowMenu
Func _exit()
        Exit
EndFunc   ;==>_exit

还有一个问题,如何循环所有Label的右键功能,二个问题。谢谢帮忙!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-16 04:19 , Processed in 0.095563 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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