private int GetDragColumnInfo(Point ptMouse, HitInfoType ht, out Rectangle colRect) { colRect = Rectangle.Empty; if (ht == HitInfoType.CustomizationForm && SourceInfo.Column.OptionsColumn.AllowMoveToCustomizationForm) { return(-101); } Rectangle visibleColPanelBounds = new Rectangle(ViewInfo.ViewRects.ColumnPanel.Left + ViewInfo.ViewRects.IndicatorWidth, ViewInfo.ViewRects.ColumnPanel.Top, ViewInfo.ViewRects.ColumnPanel.Width - ViewInfo.ViewRects.IndicatorWidth, ViewInfo.ViewRects.ColumnPanel.Height + IncreasedColumnHeight); if (!visibleColPanelBounds.Contains(ptMouse)) { if (ptMouse.X < (ViewInfo.ViewRects.Client.Left + ViewInfo.ViewRects.IndicatorWidth) || ptMouse.X > ViewInfo.ViewRects.Client.Right - 2) { return(-1); } return(-100); } ColumnInfo ci = ViewInfo.GetHitTest(ptMouse).ColumnInfo; if (ht == HitInfoType.FixedRightDiv) { ci = ViewInfo.ColumnsInfo[ViewInfo.FixedRightColumn]; } if (ht == HitInfoType.FixedLeftDiv) { ci = ViewInfo.ColumnsInfo[ViewInfo.FindFixedLeftColumn()]; } if (ci == null) { return(-1); } if (((ci.Type != ColumnInfo.ColumnInfoType.Column) && !(ci is MyTreeListBandInfo)) || ci.Type == ColumnInfo.ColumnInfoType.ColumnButton) { if (ci.Type == ColumnInfo.ColumnInfoType.ColumnBlank && TreeList.VisibleColumns.Count == 0) { colRect = TreeList.RectangleToScreen(ci.Bounds); return(0); } return(-1); } if (Data.DownHitTest.MouseDest == ci.Bounds) { return(-1); } Rectangle rect = Rectangle.Intersect(ci.Bounds, visibleColPanelBounds); int showIndicatorIndexOffset = (TreeList.OptionsView.ShowIndicator ? 1 : 0); int colIndex = ViewInfo.ColumnsInfo.Columns.IndexOf(ci) - showIndicatorIndexOffset; bool nextAfterPressed = (ci.Column.VisibleIndex == SourceInfo.Column.VisibleIndex + 1); bool lastVisbleLeft = ci.Column == ViewInfo.FixedLeftColumn; bool lastVisibleRight = IsBeforeFixedRight(ci.Column); bool lastVisible = (rect.Right == visibleColPanelBounds.Right || ci.Column.VisibleIndex == TreeList.VisibleColumns.Count - 1 || lastVisbleLeft || lastVisibleRight); if (SourceInfo.Column.VisibleIndex == -1) { nextAfterPressed = false; } if (nextAfterPressed || lastVisible) { if (rect.Width < 6) { return(-1); } Rectangle nextR = rect, nextR2 = rect; nextR2.X = nextR.Right - 1; nextR2.Width = 1; nextR.X = nextR.Right - nextR.Width / 2; nextR.Width /= 2; if (lastVisible) { if (NextRectContains(nextR, ptMouse)) { rect = UseArrows ? nextR2 : nextR; if (colIndex >= 0) { ci = ViewInfo.ColumnsInfo.Columns[colIndex++] as ColumnInfo; } } else { if (nextAfterPressed) { return(-1); } } } else { if (!NextRectContains(nextR, ptMouse)) { return(-1); } colIndex++; ci = ViewInfo.ColumnsInfo.Columns[colIndex + showIndicatorIndexOffset] as ColumnInfo; if (colIndex - 1 < ViewInfo.ColumnsInfo.Columns.Count - 1) { rect = Rectangle.Intersect(ci.Bounds, visibleColPanelBounds); } else { rect = UseArrows ? nextR2 : nextR; } } } colRect = TreeList.RectangleToScreen(rect); int columnsCount = TreeList.VisibleColumns.Count; if (ci.Type == ColumnInfo.ColumnInfoType.ColumnBlank || colIndex > columnsCount - 1) { return(columnsCount); } columnsCount = CalcFixedColumnsCount(FixedStyle.Left); if (lastVisbleLeft && colIndex > columnsCount - 1) { return(columnsCount); } columnsCount = TreeList.VisibleColumns.Count - CalcFixedColumnsCount(FixedStyle.Right); if (lastVisibleRight && colIndex > columnsCount - 1) { return(columnsCount); } if (ci.Column == null) { return(-1); } return(ci.Column.VisibleIndex); }