|
本帖最后由 lin6163 于 2012-11-8 17:14 编辑
1 、为什么左边的项移动右边,可以删除源来左边的项
而右边的项不可以移动,到左边,而是变成复制
_GUICtrlListView_CopyItems($hListView, $hListView1 ,1)
感谢 shqf 的回答
谢谢
24 行 改为 Global $hListView = GUICtrlGetHandle(GUICtrlCreateListView("", 230, 2, 180, 268))
那么第二问有没有人会知道呢?
解决方法:在第79行后面加上_GUICtrlListView_SetItemSelected($hListView, -1, False)就行了
2 、
这样是选定两项,而_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_CHECKBOXES) ;$LVS_EX_CHECKBOXES 只是使列表视图控件中对于项目的复选框有效
不是只对复选框有效的吗?#Include <GuiListView.au3>
#include <GuiConstantsEx.au3>
;Opt("GUIOnEventMode", 1)
Opt('MustDeclareVars', 1)
$Debug_LV = False ; 检查传递给函数的类名, 设置为真并使用另一控件的句柄观察其工作
_Main()
Func _Main()
Local $button ,$button1 ,$button2 ,$msg ,$sl ,$xm
GUICreate("ListView", 415, 400)
#cs
; 添加框1
Global $hListView = GUICtrlCreateListView("", 2, 2, 180, 268 ,BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
; 添加框2
Global $hListView1 = GUICtrlCreateListView("", 230, 2, 180, 268,BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
#ce
; 添加框1
Global $hListView = GUICtrlCreateListView("", 2, 2, 180, 268 )
; 添加框2
Global $hListView1 = GUICtrlCreateListView("", 230, 2, 180, 268)
; 按钮
$button = GUICtrlCreateButton ("发送",170,300,70,20)
$button1 = GUICtrlCreateButton (">>",185,80,40,20)
$button2 = GUICtrlCreateButton ("<<",185,150,40,20)
; GUICtrlSetOnEvent($button1, "_MoveRight")
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_CHECKBOXES) ;使列表视图控件中对于项目的复选框有效
_GUICtrlListView_SetExtendedListViewStyle($hListView1, $LVS_EX_CHECKBOXES )
; 添加列1
_GUICtrlListView_AddColumn($hListView, "用户名", 80)
_GUICtrlListView_AddColumn($hListView, "IP", 80)
; 添加列2
_GUICtrlListView_AddColumn($hListView1, "用户名", 80)
_GUICtrlListView_AddColumn($hListView1, "IP", 80)
; 添加项
GUICtrlCreateListViewItem("11|22" ,$hListView)
GUICtrlCreateListViewItem("33|44" ,$hListView)
GUICtrlCreateListViewItem("55|66" ,$hListView)
#cs
_GUICtrlListView_AddItem($hListView, "abc", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "192", 1)
_GUICtrlListView_AddItem($hListView, "abc 2", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "192 2", 1)
$sl = _GUICtrlListView_GetColumnCount($hListView1)
For $i = $sl To 0 Step -1
If _GUICtrlListView_GetItemChecked($hListView1, $i) = True Then
_GUICtrlListView_DeleteItem($hListView1, $i)
EndIf
Next
;MsgBox(4160, "Information", "Item : " & _GUICtrlListView_GetItemChecked($hListView, 0))
#ce
GUISetState()
; 选中项目 2
; _GUICtrlListView_SetItemChecked($hListView, 0)
; MsgBox(4160, "Information", "Item : " & _GUICtrlListView_GetItemChecked($hListView, 0))
; 循环至用户退出
Do
$msg = GUIGetMsg ()
Select
Case $msg = $button ;发送
_GUICtrlListView_CopyItems($hListView, $hListView1 ,1)
Case $msg = $button1 ;添加
_GUICtrlListView_CopyItems($hListView, $hListView1 ,1)
Case $msg = $button2 ;删除
_GUICtrlListView_CopyItems($hListView1, $hListView ,1)
EndSelect
Until $msg = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|