コード例 #1
0
    private float method_20(string A_0)
    {
        SizeF ef4   = (this.sprᝪ_0 != null) ? this.sprᝪ_0.ᜃ(A_0) : this.graphics_0.MeasureString(A_0, this.font_0, new SizeF(float.MaxValue, float.MaxValue), this.stringFormat_0);
        float width = ef4.Width;

        if ((this.interface1_0 != null) && (this.interface1_0 is TextRange))
        {
            TextRange range = this.interface1_0 as TextRange;
            if (range.IsBalanceWidthCharOfSingleByteAndDoubleByte)
            {
                width = this.method_0().method_323(range, A_0).Width;
            }
            else
            {
                Class560 class2 = ((Interface11)range.CharacterFormat).imethod_0() as Class560;
                if (class2.method_13())
                {
                    width = this.method_0().method_323(range, A_0).Width;
                }
                else if (class2.method_14())
                {
                    width = this.method_0().method_323(range, A_0.ToUpper()).Width;
                }
                if ((class2.method_15() != 1f) && (class2.method_15() > 0f))
                {
                    width *= class2.method_15();
                }
                if (class2.method_16() != 0f)
                {
                    width = this.method_0().method_244(width, A_0.Length, class2.method_16());
                }
            }
            if (((range.StartPos == 0) && (A_0 == range.Text)) && (range.OwnerParagraph != null))
            {
                Class213 class3 = ((Interface1)range.OwnerParagraph).imethod_0() as Class213;
                width += class3.method_69();
            }
        }
        if (((width == 0.0) && !this.bool_0) && (A_0.Length > 1))
        {
            width = (this.sprᝪ_0 != null) ? ((float)this.method_7(A_0, this.sprᝪ_0).Width) : ((float)this.method_6(A_0, this.font_0).Width);
        }
        return(width);
    }
コード例 #2
0
    public Size method_6(string A_0, Font A_1)
    {
        if (string.IsNullOrEmpty(A_0))
        {
            return(Size.Empty);
        }
        CharacterRange[] ranges       = new CharacterRange[] { new CharacterRange(0, A_0.Length) };
        Region[]         regionArray  = null;
        StringFormat     stringFormat = this.stringFormat_0;

        stringFormat.SetMeasurableCharacterRanges(ranges);
        regionArray = this.graphics_0.MeasureCharacterRanges(A_0, A_1, new Rectangle(0, 0, 0x7fffffff, 0x7fffffff), stringFormat);
        RectangleF bounds = regionArray[0].GetBounds(this.graphics_0);

        bounds.Width  += 2f * bounds.X;
        bounds.Height += 2f * bounds.Y;
        if (regionArray != null)
        {
            regionArray[0].Dispose();
            regionArray = null;
        }
        if ((this.interface1_0 != null) && (this.interface1_0 is TextRange))
        {
            TextRange range  = this.interface1_0 as TextRange;
            Class560  class2 = ((Interface11)range.CharacterFormat).imethod_0() as Class560;
            if ((class2.method_15() != 1f) && (class2.method_15() > 0f))
            {
                bounds.Width *= class2.method_15();
            }
            if (class2.method_16() != 0f)
            {
                bounds.Width = this.method_0().method_243(bounds.Size, A_0.Length, class2.method_16()).Width;
            }
        }
        return(Size.Ceiling(bounds.Size));
    }