Exemplo n.º 1
0
        /// <summary>
        /// get column rectangle
        /// </summary>
        /// <param name="tableControl"></param>
        /// <param name="header"></param>
        /// <param name="col"></param>
        /// <param name="forLineArea"></param>
        /// <returns></returns>
        internal Rectangle GetColumnRectangle(Header header, int col, bool forLineArea)
        {
            Rectangle rect   = new Rectangle();
            int       i      = 0;
            int       maxCol = col;

            if (col == TableControl.TAIL_COLUMN_IDX)
            {
                maxCol = tableControl.Columns.Count;
            }

            //rect.X = GetFirstColumnXOffset(tableControl);
            rect.X = GetClientRectangle().X;

            while (i < maxCol)
            {
                rect.X += tableControl.Columns[i++].Width;
            }

            if (col == TableControl.TAIL_COLUMN_IDX)
            {
                rect.Width = GetClientRectangle().Right - rect.X;
            }
            else
            {
                rect.Width = tableControl.Columns[col].Width;
            }

            //handle show lines
            if (tableControl.ShowColumnDividers)
            {
                AdjustColumnWidth(col, ref rect);
            }

            if (tableControl.RightToLeftLayout && forLineArea)
            {
                tableControl.mirrorRectangle(ref rect);
            }

            if (forLineArea)
            {
                tableControl.AdjustXCorner(ref rect);
            }

            rect.Y      = header.Height;
            rect.Height = GetClientRectangle().Bottom - header.Height;
            return(rect);
        }