示例#1
0
        /// <summary>
        /// Get rectangle of cell on TableLayout.
        /// </summary>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <returns></returns>
        internal Rectangle GetCellRectangle(Cell cell)
        {
            if (cell.RowIndex > ParentWorkflow.RowCount - 1 ||
                cell.ColumnIndex > ParentWorkflow.ColumnCount - 1)
            {
                return(Rectangle.Empty);
            }

            int[] rowHeights = ParentWorkflow.GetRowHeights();
            int[] colWidths  = ParentWorkflow.GetColumnWidths();

            Rectangle rect  = Rectangle.Empty;
            int       value = 0;
            int       index = 0;

            for (int i = 0; i < cell.RowIndex; i++)
            {
                value += rowHeights[i];
                index  = i + 1;
            }
            rect.Y      = value;
            rect.Height = rowHeights[index];

            value = 0;
            index = 0;
            for (int i = 0; i < cell.ColumnIndex; i++)
            {
                value += colWidths[i];
                index  = i + 1;
            }
            rect.X     = value;
            rect.Width = colWidths[index];

            return(rect);
        }