RT,求教,小弟谢过
用鼠标拖动list里的item,使它移动,来改变顺序
vb拖动list项改变顺序
答案:2 悬赏:10 手机版
解决时间 2021-03-17 17:03
- 提问者网友:疯子也有疯子的情调
- 2021-03-16 17:10
最佳答案
- 五星知识达人网友:我住北渡口
- 2021-03-16 17:39
拖动是做不了.只能做点击改变
private ListStr1 AS STRING
Private MoveText As Boolean
Private Sub List1_Click()
If MoveText = False Then
Label1.Caption = List1.ListIndex
ListStr1 = List1.Text
List1.RemoveItem List1.ListIndex '删除当前行.
List1.Refresh '强制全部重绘一个窗体或控件
MoveText = True
Else
Select Case List1.ListIndex
Case 0
List1.AddItem ListStr1, List1.ListIndex
Case Else
List1.AddItem ListStr1, List1.ListIndex '插到当前行的前面
End Select
List1.Refresh '强制全部重绘一个窗体或控件
MoveText = False
End If
End Sub
private ListStr1 AS STRING
Private MoveText As Boolean
Private Sub List1_Click()
If MoveText = False Then
Label1.Caption = List1.ListIndex
ListStr1 = List1.Text
List1.RemoveItem List1.ListIndex '删除当前行.
List1.Refresh '强制全部重绘一个窗体或控件
MoveText = True
Else
Select Case List1.ListIndex
Case 0
List1.AddItem ListStr1, List1.ListIndex
Case Else
List1.AddItem ListStr1, List1.ListIndex '插到当前行的前面
End Select
List1.Refresh '强制全部重绘一个窗体或控件
MoveText = False
End If
End Sub
全部回答
- 1楼网友:不想翻身的咸鱼
- 2021-03-16 18:53
'自己修改,给你写的最简单的,测试正常
'list1的oledragmode设为1,list2的oledrogmode设为1,它们为只读属性,运行前修改。 option explicit private sub form_load() dim i as integer for i = 1 to 100 list1.additem "项目" & i next end sub private sub list2_oledragdrop(data as dataobject, effect as long, button as integer, shift as integer, x as single, y as single) list2.additem data.getdata(1) '可加个判断,如果list2已存在当前拖拽的值忽律。 end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯