Example #1
0
        protected override void Draw(PaintArgs p)
        {
            base.I_Fill.Draw(p, base.BoundsAlignment);
            Rectangle boundsAlignment = base.BoundsAlignment;

            boundsAlignment.Inflate(-this.MarginOuterPixels, -this.MarginOuterPixels);
            Rectangle r  = boundsAlignment;
            Rectangle r2 = new Rectangle(boundsAlignment.Left, boundsAlignment.Top, boundsAlignment.Width, (int)this.m_RowHeights[0]);
            Rectangle r3 = new Rectangle(boundsAlignment.Left, boundsAlignment.Top, (int)this.m_ColWidths[0], boundsAlignment.Height);

            if (this.RowTitlesVisible)
            {
                r.Offset((int)this.m_ColWidths[0], 0);
                r2.Offset((int)this.m_ColWidths[0], 0);
            }
            if (this.ColTitlesVisible)
            {
                r.Offset(0, (int)this.m_RowHeights[0]);
                r3.Offset(0, (int)this.m_RowHeights[0]);
            }
            r.Intersect(boundsAlignment);
            r2.Intersect(boundsAlignment);
            r3.Intersect(boundsAlignment);
            ((IPlotTableCellFormat)this.CellsFormatting.Data).Draw(p, r);
            if (this.ColTitlesVisible)
            {
                ((IPlotTableCellFormat)this.CellsFormatting.ColTitles).Draw(p, r2);
            }
            if (this.RowTitlesVisible)
            {
                ((IPlotTableCellFormat)this.CellsFormatting.RowTitles).Draw(p, r3);
            }
            int num = boundsAlignment.Top;

            for (int i = 0; i < this.ActualRowCount; i++)
            {
                int num2 = (int)this.m_RowHeights[i];
                int num3 = boundsAlignment.Left;
                for (int j = 0; j < this.ActualColCount; j++)
                {
                    PlotTableCell plotTableCell = this[j, i];
                    int           num4          = (int)this.m_ColWidths[j];
                    plotTableCell.Bounds = new Rectangle(num3, num, num4, num2);
                    ((IPlotTableCell)plotTableCell).Draw(p, this.GridOutline.Visible, ((IPlotPen)this.GridOutline).GetPen(p));
                    num3 += num4;
                }
                num += num2;
            }
        }
Example #2
0
        protected override void CalculateDepthPixels(PaintArgs p)
        {
            this.m_MarginOuterPixels = (int)Math.Ceiling((double)p.Graphics.MeasureString(base.Font).Height *base.MarginOuter);
            Size size  = p.Graphics.MeasureString(this.CellsFormatting.Data.Font);
            Size size2 = p.Graphics.MeasureString(this.CellsFormatting.ColTitles.Font);
            Size size3 = p.Graphics.MeasureString(this.CellsFormatting.RowTitles.Font);

            if (!this.ColTitlesVisible)
            {
                size2 = new Size(0, 0);
            }
            if (!this.RowTitlesVisible)
            {
                size3 = new Size(0, 0);
            }
            Size size4 = size;

            size4 = Math2.Max(size4, size2);
            size4 = Math2.Max(size4, size3);
            this.m_CellOuterMargin = new Size((int)((double)size4.Width * this.ColOuterMargin), (int)((double)size4.Height * this.RowOuterMargin));
            int fixedWidth  = (this.ColWidthStyle != SizeStyle.FixedPixels) ? ((this.ColWidthStyle != SizeStyle.FixedCharacters) ? (-1) : ((int)((double)size4.Width * this.ColWidthValue))) : ((int)this.ColWidthValue);
            int fixedHeight = (this.RowHeightStyle != SizeStyle.FixedPixels) ? ((this.RowHeightStyle != SizeStyle.FixedCharacters) ? (-1) : ((int)((double)size4.Height * this.RowHeightValue))) : ((int)this.RowHeightValue);

            for (int i = 0; i < this.ActualColCount; i++)
            {
                for (int j = 0; j < this.ActualRowCount; j++)
                {
                    PlotTableCell plotTableCell = this[i, j];
                    if (i == 0 && j == 0)
                    {
                        ((IPlotTableCell)plotTableCell).UpdateRequiredSize(p, false, this.m_CellOuterMargin, fixedWidth, fixedHeight);
                    }
                    else if (j == 0)
                    {
                        ((IPlotTableCell)plotTableCell).UpdateRequiredSize(p, this.ColTitlesVisible, this.m_CellOuterMargin, fixedWidth, fixedHeight);
                    }
                    else if (i == 0)
                    {
                        ((IPlotTableCell)plotTableCell).UpdateRequiredSize(p, this.RowTitlesVisible, this.m_CellOuterMargin, fixedWidth, fixedHeight);
                    }
                    else
                    {
                        ((IPlotTableCell)plotTableCell).UpdateRequiredSize(p, true, this.m_CellOuterMargin, fixedWidth, fixedHeight);
                    }
                }
            }
            for (int k = 0; k < this.ActualColCount; k++)
            {
                this.m_ColWidths[k] = 0;
            }
            for (int l = 0; l < this.ActualRowCount; l++)
            {
                this.m_RowHeights[l] = 0;
            }
            for (int m = 0; m < this.ActualColCount; m++)
            {
                for (int n = 0; n < this.ActualRowCount; n++)
                {
                    PlotTableCell plotTableCell = this[m, n];
                    if (plotTableCell.RequiredSize.Width > (int)this.m_ColWidths[m])
                    {
                        this.m_ColWidths[m] = plotTableCell.RequiredSize.Width;
                    }
                    if (plotTableCell.RequiredSize.Height > (int)this.m_RowHeights[n])
                    {
                        this.m_RowHeights[n] = plotTableCell.RequiredSize.Height;
                    }
                }
            }
            int num  = 2 * this.m_MarginOuterPixels;
            int num2 = 2 * this.m_MarginOuterPixels;

            for (int num3 = 0; num3 < this.ActualColCount; num3++)
            {
                num += (int)this.m_ColWidths[num3];
            }
            for (int num4 = 0; num4 < this.ActualRowCount; num4++)
            {
                num2 += (int)this.m_RowHeights[num4];
            }
            Size size5 = new Size(num, num2);

            if (base.DockHorizontal)
            {
                base.DockDepthPixels = size5.Width;
                this.m_LengthPixels  = size5.Height;
            }
            else
            {
                base.DockDepthPixels = size5.Height;
                this.m_LengthPixels  = size5.Width;
            }
        }