public override void DoEndColumnDragging(Point p, HitInfoType ht) { Data.DragMaster.EndDrag(); if (LastPosition != null && ht != HitInfoType.CustomizationForm && !IsInCustomizationZone(p)) { MyPositionInfo pos = new MyPositionInfo(); pos.Assign(LastPosition); if (SourceBandInfo == null) { TreeList.MyRaiseDragObjectDrop(new DragObjectDropEventArgs(SourceInfo.Column, pos)); } else { TreeList.MyRaiseDragObjectDrop(new DragObjectDropEventArgs(SourceBandInfo.Band, pos)); } if (LastPosition.Valid) { if (pos.Index >= 0) { MyTreeListBandInfo posBandInfo = ColumnInfoToBandInfo(pos.Info); if (SourceBandInfo == null) { if (posBandInfo == null) { TreeList.Swap(pos.Info.Column, SourceInfo.Column); } else { TreeList.Swap(posBandInfo.Band, SourceInfo.Column); } } else { if (posBandInfo == null) { TreeList.Swap(SourceBandInfo.Band, pos.Info.Column); } else { TreeList.Swap(SourceBandInfo.Band, posBandInfo.Band); } } } } } UpdateColumnDragFrame(Rectangle.Empty); SetState(Regular); }
public override void DoColumnDragging(Point p, HitInfoType ht) { MyPositionInfo pos = new MyPositionInfo(); Rectangle rect; int index = GetDragColumnInfo(p, ht, out rect); ColumnInfo ci = ViewInfo.GetHitTest(p).ColumnInfo; Rectangle r = (rect.Width > 0 && rect.Height > 0) ? TreeList.RectangleToClient(rect) : Rectangle.Empty; pos.Assign(index, r, (ci != null) && IsDragPositionValid(index, ht, ci), ci); if (SourceBandInfo == null) { TreeList.MyRaiseDragObjectOver(new DragObjectOverEventArgs(SourceInfo.Column, pos)); } else { TreeList.MyRaiseDragObjectOver(new DragObjectOverEventArgs(SourceBandInfo.Band, pos)); } if (CheckColumnOptions(SourceInfo.Column, index)) { if (DropTargetHighlighted && !UseArrows) { DrawReversibleFrame(Data.DragColumnRect); } if (pos.Valid) { DrawReversibleFrame(rect); UpdateColumnDragFrame(rect); DropTargetHighlighted = true; } else { DropTargetHighlighted = false; UpdateColumnDragFrame(Rectangle.Empty); } Data.DragColumnRect = rect; } LastPosition = pos; DragDropEffects effect = GetDragEffect(ht, pos.Index, IsInCustomizationZone(p)); Data.DragMaster.DoDrag(TreeList.PointToScreen(p), effect, false); }