高手帮帮忙,多选出问题,怎样才能实现多选???
#include <ButtonConstants.au3>#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$List1 = GUICtrlCreateList("", 104, 40, 97, 214,BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetData(-1, "001|002|003|004|005|006|007|008|009|010")
$List2 = GUICtrlCreateList("", 272, 40, 81, 214)
$Button1 = GUICtrlCreateButton("添加>>", 216, 80, 49, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$yyy= _GUICtrlListBox_GetSelCount($List1)
if $yyy>0 Then
For $i=1 to $yyy
If GUICtrlRead($List1) <> '' Then
GUICtrlSetData($List2, GUICtrlRead($List1))
_GUICtrlListBox_DeleteString($List1, _GUICtrlListBox_GetCurSel($List1))
EndIf
$yyy= _GUICtrlListBox_GetSelCount($List1)
Next
EndIf
EndSwitch
WEnd
每次选按住CTRL选取第一行,和第五行添加至右边时都会出错~~~弄了大半天,都弄不好,高手帮帮忙,怎样才能实现多选~~ 移动一个之后,位置发生了改变~ 先移动第5行不就好了吗,从后向前移。 本帖最后由 273952582 于 2009-9-16 21:37 编辑
2# afan
那应该怎么才能做实现,这项功能呢??难不成AU3,无法做到??? 循环里用GUICtrlRead($List1)不合适,第一次它会从焦点开始读,而不会从0基序数开始读选中项
可以用 _GUICtrlListBox_GetText 试试~
另外 _GUICtrlListBox_GetSel 也是很有用的,不要放过~ 唉!!!写不出来,,谁能帮我研究研究:face (36): #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$List1 = GUICtrlCreateList("", 104, 40, 97, 214, BitOR($LBS_SORT, $LBS_STANDARD, $LBS_EXTENDEDSEL, $WS_VSCROLL, $WS_BORDER))
GUICtrlSetData(-1, "001|002|003|004|005|006|007|008|009|010")
$List2 = GUICtrlCreateList("", 272, 40, 81, 214)
$Button1 = GUICtrlCreateButton("添加>>", 216, 80, 49, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
For $i = _GUICtrlListBox_GetCount($List1) - 1 To 0 Step -1
If _GUICtrlListBox_GetSel($List1, $i) Then
GUICtrlSetData($List2, _GUICtrlListBox_GetText($List1, $i))
_GUICtrlListBox_DeleteString($List1, $i)
EndIf
Next
EndSwitch
WEnd 7# afan
:face (37): :face (37): 非常感谢~~
页:
[1]