Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请教:ListView控件分组显示数据时,如何从一组中拖动一行到另一组?

1楼
y2287958 发表于:2024/9/19 16:39:00
如题,例如:http://www.foxtable.com/webhelp/index.htm?page=2772.htm中如何将“欧洲国家”组中的“法国”拖动到“亚洲国家”组中
2楼
有点蓝 发表于:2024/9/19 23:28:00
有点不是很完美

窗口afterload事件
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
Dim listView1 As System.Windows.Forms.ListView = lvw.BaseControl
AddHandler listView1.DragDrop, AddressOf ListView1_DragDrop

全局代码
Public Sub listView1_DragDrop( sender As Object, e As System.Windows.Forms.DragEventArgs)
Dim listView1 As System.Windows.Forms.ListView = sender

Dim draggedItem As System.Windows.Forms.ListViewItem = e.Data.GetData(GetType(System.Windows.Forms.ListViewItem))
'Output.Show("draggedItem.text=" & draggedItem.Text)
Dim point As Point = listView1.PointToClient(New Point(e.X, e.Y))

Dim targetItem As System.Windows.Forms.ListViewItem = listView1.GetItemAt(point.X, point.Y)
If targetItem IsNot Nothing Then

        Dim newGroup As System.Windows.Forms.ListViewGroup = targetItem.Group
'        Output.Show("newGroup=" & (newGroup Is Nothing))
        If newGroup IsNot Nothing Then
             Output.Show("newGroup=" & newGroup.Name)
            draggedItem.Group = newGroup
             Output.Show("targetItem.Index=" & targetItem.Index)

        End If
End If
End Sub
3楼
y2287958 发表于:2024/9/20 8:07:00
虽然效果未达到,但还是谢谢版主
共3 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03906 s, 2 queries.