看来没有回答了
我来抛个砖头,一定要引来玉女呀
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <Misc.au3>
Global $fClick = False
Global $aLVClickInfo, $hTmpCombo = 0
Global $Dll = DllOpen("user32.dll")
Global $hGUI, $hListView, $sText, $hTmpCombo, $aLVRectInfo
Opt("GUICloseOnESC", 0)
Opt("MustDeclareVars", 1)
CreateGui()
Func CreateGui()
$hGUI = GUICreate("Test", 300, 200)
$hListView = _GUICtrlListView_Create($hGUI, "Col 0|Col 1|Col 2", 10, 10, 250, 200)
_GUICtrlListView_AddItem($hListView, "Item AA",0)
_GUICtrlListView_AddSubItem($hListView, 0, "Item AB", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Item AC", 2)
_GUICtrlListView_AddItem($hListView, "Item BA", 1)
_GUICtrlListView_AddItem($hListView, "Item CA", 2)
_GUICtrlListView_AddItem($hListView, "Item DA", 3)
GUISetState(@SW_SHOW, $hGUI)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
If $hTmpCombo Then
If _IsPressed("0D", $Dll) Then
$sText = GUICtrlRead($hTmpCombo)
_GUICtrlListView_SetItemText($hListView, $aLVClickInfo[0], $sText, $aLVClickInfo[1])
GUICtrlDelete($hTmpCombo)
$hTmpCombo = 0
GUICtrlSetState($hListView, $GUI_ENABLE)
EndIf
If _IsPressed("1B", $Dll) Then
GUICtrlDelete($hTmpCombo)
$hTmpCombo = 0
GUICtrlSetState($hListView, $GUI_ENABLE)
EndIf
EndIf
If $fClick Then
$fClick = False
GUICtrlDelete($hTmpCombo)
Switch $aLVClickInfo[1]
Case 0
$aLVRectInfo = _GUICtrlListView_GetItemRect($hListView, $aLVClickInfo[0], 2)
Case Else
$aLVRectInfo = _GUICtrlListView_GetSubItemRect($hListView, $aLVClickInfo[0], $aLVClickInfo[1])
EndSwitch
$hTmpCombo = GUICtrlCreateCombo("", $aLVRectInfo[0] + 10, $aLVRectInfo[1] + 10, 100, $aLVRectInfo[3] - $aLVRectInfo[1])
GUICtrlSetData($hTmpCombo, "male|female|ladyboy")
GUICtrlSetState($hListView, $GUI_DISABLE)
GUICtrlSetState($hTmpCombo, BitOR($GUI_FOCUS, $GUI_ONTOP))
EndIf
WEnd
DllClose($Dll)
GUIDelete($hGUI)
EndFunc
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
If $hTmpCombo Then Return $GUI_RUNDEFMSG
Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $hListView And DllStructGetData($tNMHDR, "Code") = $NM_CLICK Then
$aLVClickInfo = _GUICtrlListView_SubItemHitTest($hListView)
If $aLVClickInfo[0] <> -1 Then $fClick = True
EndIf
Return $GUI_RUNDEFMSG
EndFunc
|