Пример #1
0
        private Size GetMaxTextSize(PaintArgs p, string[] strings, ITextLayoutFull textLayout, Font font)
        {
            Size size = Size.Empty;

            for (int i = 0; i < strings.Length; i++)
            {
                size = Math2.Max(size, textLayout.GetRequiredSize(strings[i], font, p.Graphics));
            }
            return(size);
        }
Пример #2
0
        private void GenerateTicks(PaintArgs p, PlotChannelImage channel)
        {
            this.m_Ticks.Clear();
            this.m_MaxSizeTickLabels = Size.Empty;
            double num = channel.IntensityGradient.Span / (double)(this.m_Positions.Length - 1);

            for (int i = 0; i < this.m_Positions.Length; i++)
            {
                double value = channel.IntensityGradient.Min + (double)i * num;
                string text  = this.m_TextFormat.GetText(value);
                this.m_MaxSizeTickLabels = Math2.Max(this.m_MaxSizeTickLabels, p.Graphics.MeasureString(text, base.Font));
                this.m_Ticks.Add(text);
            }
        }
Пример #3
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;
            }
        }