'Assign these globally Private downHitInfo As GridHitInfo = Nothing Private hitInfo As GridHitInfo = Nothing Dim dt As DataTable
Private Sub gridParts_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles gridParts.MouseDown hitInfo = GridView1.CalcHitInfo(New Point(e.X, e.Y)) If Control.ModifierKeys <> Keys.None Then Exit Sub If e.Button = MouseButtons.Left AndAlso hitInfo.RowHandle >= 0 Then downHitInfo = hitInfo End If End Sub
Private Sub gridParts_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles gridParts.MouseMove If e.Button = MouseButtons.Left And Not downHitInfo Is Nothing Then Dim dragSize As Size = SystemInformation.DragSize Dim dragRect As Rectangle = New Rectangle(New Point(downHitInfo.HitPoint.X - dragSize.Width / 2, _ downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize) If Not dragRect.Contains(New Point(e.X, e.Y)) Then Dim info As GridViewInfo info = CType(GridView1.GetViewInfo(), GridViewInfo) If info.RowsInfo.Count = 1 Then Else Dim selectedRows() As Integer = GridView1.GetSelectedRows() gridParts.DoDragDrop(selectedRows, DragDropEffects.Copy) downHitInfo = Nothing Dim ev As DevExpress.Utils.DXMouseEventArgs = DevExpress.Utils.DXMouseEventArgs.GetMouseArgs(e) ev.Handled = True End If End If End If End Sub
Private Sub treeList1_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs) Handles TreeList1.DragEnter e.Effect = DragDropEffects.Copy End Sub
Private Sub treeList1_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles TreeList1.DragDrop dt.Clear() Dim selectedRows() As Integer = TryCast(e.Data.GetData(GetType(Integer())), Integer()) Dim i As Integer = 0 If selectedRows.Length <> 0 Then For Each rowHandle As Integer In selectedRows Dim row As DataRow = GridView1.GetDataRow(rowHandle) dt.ImportRow(row) Next rowHandle End If Dim hi As TreeListHitInfo = TreeList1.CalcHitInfo(TreeList1.PointToClient(New Point(e.X, e.Y))) If hi Is Nothing Then Return End If Dim arrlist As ArrayList = TreeList1.GetDataRecordByNode(hi.Node) Dim str As String = arrlist(0).ToString MoveData(dt, str) End Sub
GridView1.OptionsSelection.MultiSelect = True GridView1.OptionsBehavior.Editable = False
GridView2.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseUp