Exemplo n.º 1
0
        private void method_2(Graphics graphics_0, int int_8, int int_9, int int_10, int int_11, string string_0)
        {
            SizeF ef   = graphics_0.MeasureString(string_0, this.font_1);
            int   num  = ((int_8 + int_10) - this.int_2) - Convert.ToInt32(ef.Width * this.float_1);
            int   num2 = (int_9 + this.int_3) + SupportClass.GetAscent(this.font_1);

            this.Graphics_0 = graphics_0;
            graphics_0.DrawString(string_0, this.font_0, SupportClass.GraphicsManager.manager.GetBrush(graphics_0), (float)num, (float)((num2 - Convert.ToInt32(this.font_0.GetHeight() * this.float_1)) + this.int_6));
        }
Exemplo n.º 2
0
 public static void drawText(PdfContentByte pcb, Graphics g, string text, int x, int y, int w, int h, bool wordWrap, bool underLine, int align, int valign, int indent, System.Drawing.Font font, System.Drawing.Color c)
 {
     if ((text != null) && (text.Trim().Length != 0))
     {
         System.Drawing.Font fm = font;
         if (align != PropertyDefine.CA_CENTER)
         {
             if (align != PropertyDefine.CA_LEFT)
             {
                 if (align == PropertyDefine.CA_RIGHT)
                 {
                     w -= indent;
                 }
             }
             else
             {
                 x += indent;
                 w -= indent;
             }
         }
         else
         {
             x += indent;
             w -= indent * 2;
         }
         int num6    = (int)getFontWidth(g, fm, text);
         int ascent  = SupportClass.GetAscent(fm);
         int descent = SupportClass.GetDescent(fm);
         if (!wordWrap)
         {
             if (num6 > w)
             {
                 text = smethod_2(text, fm, w, g);
                 num6 = (int)getFontWidth(g, fm, text);
             }
             int num9 = x;
             if (align == PropertyDefine.CA_CENTER)
             {
                 num9 = x + ((w - num6) / 2);
             }
             else if (align == PropertyDefine.CA_RIGHT)
             {
                 num9 = (x + w) - num6;
             }
             int num10 = (y + h) - ascent;
             if (valign == PropertyDefine.CVA_MIDDLE)
             {
                 num10 = (y + (((h - ascent) - descent) / 2)) + descent;
             }
             else if (valign == PropertyDefine.CVA_BOTTOM)
             {
                 num10 = y + descent;
             }
             smethod_0(pcb, g, text, num9, num10, num9 + num6, num10 - (descent + ascent), font, c);
         }
         else
         {
             ArrayList list   = wrapString(text, fm, w);
             int       height = (int)fm.GetHeight();
             int       num2   = y;
             if (valign == PropertyDefine.CVA_MIDDLE)
             {
                 num2 = y + ((h - (height * list.Count)) / 2);
             }
             else if (valign == PropertyDefine.CVA_BOTTOM)
             {
                 num2 = (y + h) - (height * list.Count);
             }
             if (num2 < y)
             {
                 num2 = y;
             }
             for (int i = list.Count - 1; i >= 0; i--)
             {
                 if (num2 > (y + h))
                 {
                     break;
                 }
                 string s = (string)list[i];
                 if (s.EndsWith("\n"))
                 {
                     s = s.Substring(0, s.Length - 1);
                 }
                 num6 = (int)getFontWidth(g, fm, s);
                 int num5 = x;
                 if (align == PropertyDefine.CA_CENTER)
                 {
                     num5 = x + ((w - num6) / 2);
                 }
                 else if (align == PropertyDefine.CA_RIGHT)
                 {
                     num5 = (x + w) - num6;
                 }
                 int num4 = num2 + ascent;
                 smethod_0(pcb, g, s, num5, num4, num5 + num6, num4 - (descent + ascent), font, c);
                 num2 += height;
             }
         }
     }
 }