System.Windows.Forms.CustomTabControl.GetTabPosition C# (CSharp) Method

GetTabPosition() public method

public GetTabPosition ( int index ) : Point
index int
return Point
        public Point GetTabPosition(int index)
        {
            //	If we are not multiline then the column is the index and the row is 0.
            if (!this.Multiline){
                return new Point(0, index);
            }

            //	If there is only one row then the column is the index
            if (this.RowCount == 1){
                return new Point(0, index);
            }

            //	We are in a true multi-row scenario
            int row = this.GetTabRow(index);
            Rectangle rect = this.GetTabRect(index);
            int column = -1;

            //	Scan from left to right along rows, skipping to next row if it is not the one we want.
            for (int testIndex = 0; testIndex < this.TabCount; testIndex ++){
                Rectangle testRect = this.GetTabRect(testIndex);
                if (this.Alignment <= TabAlignment.Bottom){
                    if (testRect.Y == rect.Y){
                        column += 1;
                    }
                } else {
                    if (testRect.X == rect.X){
                        column += 1;
                    }
                }

                if (testRect.Location.Equals(rect.Location)){
                    return new Point(row, column);
                }
            }

            return new Point(0, 0);
        }