Beispiel #1
0
        // Token: 0x06002AE5 RID: 10981 RVA: 0x000A6A94 File Offset: 0x000A4C94
        private void method_5(Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, out Rectangle textRect, out Rectangle imageRect)
        {
            int num  = 0;
            int num2 = textSize.Height + 0 + imageSize.Height;

            if (textFirst)
            {
                num += 2;
            }
            if (textSize.Width > totalArea.Width)
            {
                textSize.Width = totalArea.Width;
            }
            if (num2 > totalArea.Height && textFirst)
            {
                imageSize = Size.Empty;
                num2      = totalArea.Height;
            }
            int num3 = totalArea.Height - num2;
            int num4 = 0;
            VerticalAlignment verticalAlignment  = Class479.smethod_2(this.TextAlign);
            VerticalAlignment verticalAlignment2 = Class479.smethod_2(base.ImageAlign);

            if (verticalAlignment2 == VerticalAlignment.Top)
            {
                num4 = 0;
            }
            else if (verticalAlignment2 == VerticalAlignment.Bottom && verticalAlignment == VerticalAlignment.Bottom)
            {
                num4 = num3;
            }
            else if (verticalAlignment2 == VerticalAlignment.Center && (verticalAlignment == VerticalAlignment.Top || verticalAlignment == VerticalAlignment.Center))
            {
                num4 += num3 / 3;
            }
            else
            {
                num4 += 2 * (num3 / 3);
            }
            Rectangle rectangle;
            Rectangle rectangle2;

            if (textFirst)
            {
                rectangle  = new Rectangle(Class479.smethod_3(totalArea, textSize, this.TextAlign).Left, totalArea.Top + num4, textSize.Width, textSize.Height);
                rectangle2 = new Rectangle(Class479.smethod_3(totalArea, imageSize, base.ImageAlign).Left, rectangle.Bottom + num, imageSize.Width, imageSize.Height);
            }
            else
            {
                rectangle2 = new Rectangle(Class479.smethod_3(totalArea, imageSize, base.ImageAlign).Left, totalArea.Top + num4, imageSize.Width, imageSize.Height);
                rectangle  = new Rectangle(Class479.smethod_3(totalArea, textSize, this.TextAlign).Left, rectangle2.Bottom + num, textSize.Width, textSize.Height);
                if (rectangle.Bottom > totalArea.Bottom)
                {
                    rectangle.Y = totalArea.Top;
                }
            }
            textRect  = rectangle;
            imageRect = rectangle2;
        }
Beispiel #2
0
        // Token: 0x06002AE2 RID: 10978 RVA: 0x000A6644 File Offset: 0x000A4844
        private void method_3(ref Rectangle content_rect, out Rectangle textRectangle, out Rectangle imageRectangle)
        {
            Size textSize  = TextRenderer.MeasureText(this.Text, this.Font, content_rect.Size, this.textFormatFlags_0);
            Size imageSize = (base.Image == null) ? Size.Empty : base.Image.Size;

            textRectangle  = Rectangle.Empty;
            imageRectangle = Rectangle.Empty;
            switch (base.TextImageRelation)
            {
            case TextImageRelation.Overlay:
                textRectangle = Class479.smethod_0(ref content_rect, ref textSize, this.TextAlign);
                if (this.pushButtonState_0 == PushButtonState.Pressed && !Application.RenderWithVisualStyles)
                {
                    textRectangle.Offset(1, 1);
                }
                if (base.Image != null)
                {
                    imageRectangle = Class479.smethod_0(ref content_rect, ref imageSize, base.ImageAlign);
                    return;
                }
                break;

            case TextImageRelation.ImageAboveText:
                content_rect.Inflate(-4, -4);
                this.method_5(content_rect, false, textSize, imageSize, out textRectangle, out imageRectangle);
                return;

            case TextImageRelation.TextAboveImage:
                content_rect.Inflate(-4, -4);
                this.method_5(content_rect, true, textSize, imageSize, out textRectangle, out imageRectangle);
                return;

            case (TextImageRelation)3:
            case (TextImageRelation)5:
            case (TextImageRelation)6:
            case (TextImageRelation)7:
                break;

            case TextImageRelation.ImageBeforeText:
                content_rect.Inflate(-4, -4);
                this.method_4(content_rect, false, textSize, imageSize, out textRectangle, out imageRectangle);
                return;

            case TextImageRelation.TextBeforeImage:
                content_rect.Inflate(-4, -4);
                this.method_4(content_rect, true, textSize, imageSize, out textRectangle, out imageRectangle);
                break;

            default:
                return;
            }
        }
Beispiel #3
0
        // Token: 0x06002AE4 RID: 10980 RVA: 0x000A68FC File Offset: 0x000A4AFC
        private void method_4(Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, out Rectangle textRect, out Rectangle imageRect)
        {
            int num  = 0;
            int num2 = textSize.Width + 0 + imageSize.Width;

            if (!textFirst)
            {
                num += 2;
            }
            if (num2 > totalArea.Width)
            {
                textSize.Width = totalArea.Width - num - imageSize.Width;
                num2           = totalArea.Width;
            }
            int num3 = totalArea.Width - num2;
            int num4 = 0;
            HorizontalAlignment horizontalAlignment  = Class479.smethod_1(this.TextAlign);
            HorizontalAlignment horizontalAlignment2 = Class479.smethod_1(base.ImageAlign);

            if (horizontalAlignment2 == HorizontalAlignment.Left)
            {
                num4 = 0;
            }
            else if (horizontalAlignment2 == HorizontalAlignment.Right && horizontalAlignment == HorizontalAlignment.Right)
            {
                num4 = num3;
            }
            else if (horizontalAlignment2 == HorizontalAlignment.Center && (horizontalAlignment == HorizontalAlignment.Left || horizontalAlignment == HorizontalAlignment.Center))
            {
                num4 += num3 / 3;
            }
            else
            {
                num4 += 2 * (num3 / 3);
            }
            Rectangle rectangle;
            Rectangle rectangle2;

            if (textFirst)
            {
                rectangle  = new Rectangle(totalArea.Left + num4, Class479.smethod_3(totalArea, textSize, this.TextAlign).Top, textSize.Width, textSize.Height);
                rectangle2 = new Rectangle(rectangle.Right + num, Class479.smethod_3(totalArea, imageSize, base.ImageAlign).Top, imageSize.Width, imageSize.Height);
            }
            else
            {
                rectangle2 = new Rectangle(totalArea.Left + num4, Class479.smethod_3(totalArea, imageSize, base.ImageAlign).Top, imageSize.Width, imageSize.Height);
                rectangle  = new Rectangle(rectangle2.Right + num, Class479.smethod_3(totalArea, textSize, this.TextAlign).Top, textSize.Width, textSize.Height);
            }
            textRect  = rectangle;
            imageRect = rectangle2;
        }