当前位置: 首页>>代码示例>>C#>>正文


C# XGraphics.DrawString方法代码示例

本文整理汇总了C#中PdfSharp.Drawing.XGraphics.DrawString方法的典型用法代码示例。如果您正苦于以下问题:C# XGraphics.DrawString方法的具体用法?C# XGraphics.DrawString怎么用?C# XGraphics.DrawString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PdfSharp.Drawing.XGraphics的用法示例。


在下文中一共展示了XGraphics.DrawString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderPage

    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      string facename = "Times";
      XFont fontR = new XFont(facename, 40);
      XFont fontB = new XFont(facename, 40, XFontStyle.Bold);
      XFont fontI = new XFont(facename, 40, XFontStyle.Italic);
      XFont fontBI = new XFont(facename, 40, XFontStyle.Bold | XFontStyle.Italic);
      //gfx.DrawString("Hello", this.properties.Font1.Font, this.properties.Font1.Brush, 200, 200);
      double x = 80;
      XPen pen = XPens.SlateBlue;
      gfx.DrawLine(pen, x, 100, x, 600);
      gfx.DrawLine(pen, x - 50, 200, 400, 200);
      gfx.DrawLine(pen, x - 50, 300, 400, 300);
      gfx.DrawLine(pen, x - 50, 400, 400, 400);
      gfx.DrawLine(pen, x - 50, 500, 400, 500);

      double lineSpace = fontR.GetHeight(gfx);
      int cellSpace = fontR.FontFamily.GetLineSpacing(fontR.Style);
      int cellAscent = fontR.FontFamily.GetCellAscent(fontR.Style);
      int cellDescent = fontR.FontFamily.GetCellDescent(fontR.Style);
      double cyAscent = lineSpace * cellAscent / cellSpace;

      XFontMetrics metrics = fontR.Metrics;

      XSize size;
      gfx.DrawString("Times 40", fontR, this.properties.Font1.Brush, x, 200);
      size = gfx.MeasureString("Times 40", fontR);
      gfx.DrawLine(this.properties.Pen3.Pen, x, 200, x + size.Width, 200);

      gfx.DrawString("Times bold 40", fontB, this.properties.Font1.Brush, x, 300);
      size = gfx.MeasureString("Times bold 40", fontB);
      //gfx.DrawLine(this.properties.Pen3.Pen, x, 300, x + size.Width, 300);

      gfx.DrawString("Times italic 40", fontI, this.properties.Font1.Brush, x, 400);
      size = gfx.MeasureString("Times italic 40", fontI);
      //gfx.DrawLine(this.properties.Pen3.Pen, x, 400, x + size.Width, 400);

      gfx.DrawString("Times bold italic 40", fontBI, this.properties.Font1.Brush, x, 500);
      size = gfx.MeasureString("Times bold italic 40", fontBI);
      //gfx.DrawLine(this.properties.Pen3.Pen, x, 500, x + size.Width, 500);

#if true___
      // Check Malayalam
      XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
      XFont Kartika = new XFont("Kartika", 20, XFontStyle.Regular, options);
      XFont AnjaliOldLipi = new XFont("AnjaliOldLipi", 20, XFontStyle.Regular, options);
      gfx.DrawString("മകനെ ഇത് ഇന്ത്യയുടെ ഭൂപടം", Kartika, this.properties.Font1.Brush, x, 600);
      gfx.DrawString("മകനെ ഇത് ഇന്ത്യയുടെ ഭൂപടം", AnjaliOldLipi, this.properties.Font1.Brush, x, 650);
#endif
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:52,代码来源:TestText02.cs

示例2: RenderPage

    public override void RenderPage(XGraphics gfx)
    {
      base.RenderPage(gfx);

      string text = "TgfÄÖÜWi9";
      if (this.properties.Font1.Text != "")
        text = this.properties.Font1.Text;
      float x = 100, y = 300;
      string familyName = properties.Font1.FamilyName;
      XFontStyle style = this.properties.Font1.Style;
      float emSize = this.properties.Font1.Size;

      //familyName = "Verdana";
      //style = XFontStyle.Regular;
      //emSize = 20;
      //text = "X";

      XFont font = CreateFont(familyName, emSize, style);
      //font = this.properties.Font1.Font;
      XSize size = gfx.MeasureString(text, font);

      double lineSpace = font.GetHeight(gfx);
      int cellSpace = font.FontFamily.GetLineSpacing(style);
      int cellAscent = font.FontFamily.GetCellAscent(style);
      int cellDescent = font.FontFamily.GetCellDescent(style);
      int cellLeading = cellSpace - cellAscent - cellDescent;

      double ascent = lineSpace * cellAscent / cellSpace;
      gfx.DrawRectangle(XBrushes.Bisque, x, y - ascent, size.Width, ascent);

      double descent = lineSpace * cellDescent / cellSpace;
      gfx.DrawRectangle(XBrushes.LightGreen, x, y, size.Width, descent);

      double leading = lineSpace * cellLeading / cellSpace;
      gfx.DrawRectangle(XBrushes.Yellow, x, y + descent, size.Width, leading);

      //gfx.DrawRectangle(this.properties.Brush1.Brush, x, y - size.Height, size.Width, size.Height);
      //gfx.DrawLine(this.properties.Pen2.Pen, x, y, x + size.Width, y);
      //gfx.DrawString("Hello", this.properties.Font1.Font, this.properties.Font1.Brush, 200, 200);

#if true_
      XPdfFontOptions pdfOptions = new XPdfFontOptions(false, true);
      font = new XFont("Tahoma", 8, XFontStyle.Regular, pdfOptions);
      text = "Hallo";
      text = chinese;
#endif
      gfx.DrawString(text, font, this.properties.Font1.Brush, x, y);

#if true
      XFont font2 = CreateFont(familyName, emSize, XFontStyle.Italic);
      gfx.DrawString(text, font2, this.properties.Font1.Brush, x, y+50);
#endif
      //gfx.DrawLine(XPens.Red, x, y + 10, x + 13.7, y + 10);
      //gfx.DrawString(text, font, this.properties.Font1.Brush, x, y + 20);
    }
开发者ID:DavidS,项目名称:MigraDoc,代码行数:55,代码来源:TestText01.cs

示例3: DrawBarCharts

        public void DrawBarCharts(XGraphics gfx)
        {
            XPoint backgroundPoint = new XPoint(20, page_.Height * 0.55);
            XRect backgroundRect = new XRect(backgroundPoint.X, backgroundPoint.Y, page_.Width - 40, page_.Height * 0.425);
            double quarterRectWidth = backgroundRect.Width * 0.25;
            double offset = quarterRectWidth * 0.25;
            DrawingUtil.DrawOutlineRect(backgroundRect, gfx, new XSize(40,40));
            gfx.DrawRoundedRectangle(new XSolidBrush(XColor.FromKnownColor(XKnownColor.Gray)),
                backgroundRect,
                new XSize(40, 40));

            DoubleBar ShoulderFlexionBar = new DoubleBar(userParameters_[dataReadStart + 4], userParameters_[dataReadStart + 9], gfx);
            ShoulderFlexionBar.Draw(new XPoint(quarterRectWidth - offset, backgroundPoint.Y + 20),
                backgroundRect,
                XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png"));

            DoubleBar hipFlexionBar = new DoubleBar(userParameters_[dataReadStart + 5], userParameters_[dataReadStart + 10], gfx);
            hipFlexionBar.Draw(new XPoint(quarterRectWidth * 2 - offset, backgroundPoint.Y + 20),
                backgroundRect,
                 XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png"));

            DoubleBar kneeFlexionBar = new DoubleBar(userParameters_[dataReadStart + 6], userParameters_[dataReadStart + 11], gfx);
            kneeFlexionBar.Draw(new XPoint(quarterRectWidth * 3 - offset, backgroundPoint.Y + 20),
                backgroundRect,
                XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png"));

            DoubleBar ankleFlexionBar = new DoubleBar(userParameters_[dataReadStart + 7], userParameters_[dataReadStart + 12], gfx);
            ankleFlexionBar.Draw(new XPoint(quarterRectWidth * 4 - offset, backgroundPoint.Y + 20),
                backgroundRect,
                XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png"));

            gfx.DrawString("Degrees :",
                new XFont("Arial", 10),
                XBrushes.Black,
                (backgroundPoint + new XPoint(0, 20)) + new XPoint(backgroundRect.Width * 0.05, backgroundRect.Height * 0.05),
                XStringFormats.Center);

            gfx.DrawString("LSI % :",
                new XFont("Arial", 10),
                XBrushes.Black,
                (backgroundPoint + new XPoint(0, 20)) + new XPoint(backgroundRect.Width * 0.05, backgroundRect.Height * 0.125),
                XStringFormats.Center);

            XPoint top = new XPoint(backgroundPoint.X, backgroundPoint.Y + backgroundRect.Height * 0.2);
            XPoint bottom = new XPoint(backgroundPoint.X, backgroundPoint.Y + backgroundRect.Height * 0.8);
            for (int i = 11; i > 0; i--)
            {
                float increment = -i * 0.1f;

                XPoint percentagePoint = DrawingUtil.Instance.Interpolate(top, bottom, increment);
                percentagePoint = new XPoint(percentagePoint.X, Math.Floor(percentagePoint.Y));
                gfx.DrawString(((11 - i) * 10).ToString() + "%", new XFont("Arial", 8), XBrushes.Black, percentagePoint + new XPoint(5, -2));
                gfx.DrawLine(XPens.LightGray, percentagePoint, percentagePoint + new XPoint(backgroundRect.Width, 0));
            }
        }
开发者ID:Nodgez,项目名称:PDFReporter,代码行数:55,代码来源:OHS_Page.cs

示例4: RenderTextStyles

    void RenderTextStyles(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      string facename = "Times New Roman";
      XFont fontRegular = new XFont(facename, 20);
      XFont fontBold = new XFont(facename, 20, XFontStyle.Bold);
      XFont fontItalic = new XFont(facename, 20, XFontStyle.Italic);
      XFont fontBoldItalic = new XFont(facename, 20, XFontStyle.BoldItalic);

      // The default alignment is baseline left (that differs from GDI+)
      gfx.DrawString("Times (regular)", fontRegular, XBrushes.DarkSlateGray, 0, 30);
      gfx.DrawString("Times (bold)", fontBold, XBrushes.DarkSlateGray, 0, 65);
      gfx.DrawString("Times (italic)", fontItalic, XBrushes.DarkSlateGray, 0, 100);
      gfx.DrawString("Times (bold italic)", fontBoldItalic, XBrushes.DarkSlateGray, 0, 135);
    }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:16,代码来源:TextStyles.cs

示例5: RenderMeasureText

    void RenderMeasureText(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XFontStyle style = XFontStyle.Regular;
      XFont font = new XFont("Times New Roman", 95, style);

      string text = "Hello";
      double x = 20, y = 100;
      XSize size = gfx.MeasureString(text, font);

      double lineSpace = font.GetHeight(gfx);
      int cellSpace = font.FontFamily.GetLineSpacing(style);
      int cellAscent = font.FontFamily.GetCellAscent(style);
      int cellDescent = font.FontFamily.GetCellDescent(style);
      int cellLeading = cellSpace - cellAscent - cellDescent;

      // Get effective ascent
      double ascent = lineSpace * cellAscent / cellSpace;
      gfx.DrawRectangle(XBrushes.Bisque, x, y - ascent, size.Width, ascent);

      // Get effective descent
      double descent = lineSpace * cellDescent / cellSpace;
      gfx.DrawRectangle(XBrushes.LightGreen, x, y, size.Width, descent);

      // Get effective leading
      double leading = lineSpace * cellLeading / cellSpace;
      gfx.DrawRectangle(XBrushes.Yellow, x, y + descent, size.Width, leading);

      // Draw text half transparent
      XColor color = XColors.DarkSlateBlue;
      color.A = 0.6;
      gfx.DrawString(text, font, new XSolidBrush(color), x, y);
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:34,代码来源:MeasureText.cs

示例6: DrawPage

        public void DrawPage(XGraphics gfx, PointF pagepos, PageDrawOptions opts)
        {
            float acty = 0;

            for (int i = 0; i < m_noDelimPageCount; i++)
            {
                Pane pane = m_panes[i];
                pane.Draw(gfx, new PointF(pagepos.X, pagepos.Y + acty), true);
                acty += pane.Height;
            }

            if (opts != null)
            {
                string header = opts.Header.Replace("%c", PageNumber.ToString());
                string footer = opts.Footer.Replace("%c", PageNumber.ToString());

                if (header != "")
                {
                    float hdrwi = (float)gfx.MeasureString(header, opts.HeaderFont).Width;
                    float hdrhi = (float)gfx.MeasureString(header, opts.HeaderFont).Height;
                    gfx.DrawString(header, opts.HeaderFont, opts.HeaderColor, new PointF(pagepos.X + opts.PageWidth / 2 - hdrwi / 2, pagepos.Y - hdrhi), XStringFormat.TopLeft);
                }
                if (footer != "")
                {
                    float ftrwi = (float)gfx.MeasureString(footer, opts.FooterFont).Width;
                    gfx.DrawString(footer, opts.FooterFont, opts.FooterColor, new PointF(pagepos.X + opts.PageWidth / 2 - ftrwi / 2, pagepos.Y + opts.PageHeight), XStringFormat.TopLeft);
                }
            }
        }
开发者ID:BackupTheBerlios,项目名称:zp7-svn,代码行数:29,代码来源:LogPage.cs

示例7: RenderPage

    public override void RenderPage(XGraphics gfx)
    {
      //base.RenderPage(gfx);

      XFont font1 = new XFont("Arial", 9);
      XFont font2 = new XFont("Arial", 9, XFontStyle.Italic);
      XFont font3 = new XFont("Arial", 9, XFontStyle.Bold);
      XSolidBrush brush = new XSolidBrush(XColors.Black);

      gfx.DrawString("Page 5", font1, brush, 100, 100);
      gfx.DrawString("Water Sports You've Done continued", font2, brush, 100, 200);
      gfx.DrawString("Rowing", font1, brush, 100, 250);
      gfx.DrawString("Snorkeling", font1, brush, 100, 300);
      gfx.DrawString("WINTER SPORTS, SKIING, SKIING IN THE US", font3, XBrushes.Red, 100, 320);

      gfx.DrawLine(XPens.Red, 100, 100, 200, 200);

      gfx.DrawString("Resorts You've Skied in Vermont", font3, brush, 100, 400);
      gfx.DrawString("Haystack", font1, brush, 100, 420);

//      string text = "TgfÄÖÜWi9";
//      if (this.properties.Font1.Text != "")
//        text = this.properties.Font1.Text;
//      float x = 100, y = 300;
//      string familyName = properties.Font1.FamilyName;
//      XFontStyle style = this.properties.Font1.Style;
//      float emSize = this.properties.Font1.Size;
//      XFont font = CreateFont(familyName, emSize, style);
//      font = this.properties.Font1.Font;
//      XSize size = gfx.MeasureString(text, font);

//      double lineSpace = font.GetHeight(gfx);
//      int cellSpace   = font.FontFamily.GetLineSpacing(style);
//      int cellAscent  = font.FontFamily.GetCellAscent(style);
//      int cellDescent = font.FontFamily.GetCellDescent(style);
//      int cellLeading = cellSpace - cellAscent - cellDescent;

//      double ascent  = lineSpace * cellAscent / cellSpace;
//      gfx.DrawRectangle(XBrushes.Bisque, x, y - ascent, size.Width, ascent);

//      double descent = lineSpace * cellDescent / cellSpace;
//      gfx.DrawRectangle(XBrushes.LightGreen, x, y, size.Width, descent);

//      double leading = lineSpace * cellLeading / cellSpace;
//      gfx.DrawRectangle(XBrushes.Yellow, x, y + descent, size.Width, leading);

//      //gfx.DrawRectangle(this.properties.Brush1.Brush, x, y - size.Height, size.Width, size.Height);
//      //gfx.DrawLine(this.properties.Pen2.Pen, x, y, x + size.Width, y);
//      //gfx.DrawString("Hello", this.properties.Font1.Font, this.properties.Font1.Brush, 200, 200);

//#if true_
//      XPdfFontOptions pdfOptions = new XPdfFontOptions(false, true);
//      font = new XFont("Tahoma", 8, XFontStyle.Regular, pdfOptions);
//      text = "Hallo";
//      text = chinese;
//#endif
//      gfx.DrawString(text, font, this.properties.Font1.Brush, x, y);
//      gfx.DrawLine(XPens.Red, 0, 0, 100, 100);
//      gfx.DrawString(text, font, this.properties.Font1.Brush, x, y + 20);
    }
开发者ID:DavidS,项目名称:MigraDoc,代码行数:60,代码来源:Acro8Bug.cs

示例8: DrawText

    /// <summary>
    /// Draws text in different styles.
    /// </summary>
    void DrawText(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "Text Styles");

      string facename = "Times New Roman";
      XFont fontRegular = new XFont(facename, 20);
      XFont fontBold = new XFont(facename, 20, XFontStyle.Bold);
      XFont fontItalic = new XFont(facename, 20, XFontStyle.Italic);
      XFont fontBoldItalic = new XFont(facename, 20, XFontStyle.BoldItalic);

      // The default alignment is baseline left (that differs from GDI+)
      gfx.DrawString("Times (regular)", fontRegular, XBrushes.DarkSlateGray, 0, 30);
      gfx.DrawString("Times (bold)", fontBold, XBrushes.DarkSlateGray, 0, 65);
      gfx.DrawString("Times (italic)", fontItalic, XBrushes.DarkSlateGray, 0, 100);
      gfx.DrawString("Times (bold italic)", fontBoldItalic, XBrushes.DarkSlateGray, 0, 135);

      EndBox(gfx);
    }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:21,代码来源:Text.cs

示例9: RenderTextStyles

    static void RenderTextStyles(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);

      const string facename = "Times New Roman";
      XFont fontRegular = new XFont(facename, 20, XFontStyle.Regular, options);
      XFont fontBold = new XFont(facename, 20, XFontStyle.Bold, options);
      XFont fontItalic = new XFont(facename, 20, XFontStyle.Italic, options);
      XFont fontBoldItalic = new XFont(facename, 20, XFontStyle.BoldItalic, options);

      // The default alignment is baseline left (that differs from GDI+)
      gfx.DrawString(facename +" (regular)", fontRegular, XBrushes.DarkSlateGray, 0, 30);
      gfx.DrawString(facename + " (bold)", fontBold, XBrushes.DarkSlateGray, 0, 65);
      gfx.DrawString(facename + " (italic)", fontItalic, XBrushes.DarkSlateGray, 0, 100);
      gfx.DrawString(facename +" (bold italic)", fontBoldItalic, XBrushes.DarkSlateGray, 0, 135);
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:18,代码来源:TextStyles2.cs

示例10: RenderTextStyles

    static void RenderTextStyles(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      const string facename = "Segoe UI";
      //const string facename = "Frutiger LT 55 Roman,Frutiger LT 45 Light";

      XFont fontRegular = new XFont(facename, 20);
      XFont fontBold = new XFont(facename, 20, XFontStyle.Bold);
      XFont fontItalic = new XFont(facename, 20, XFontStyle.Italic);
      XFont fontBoldItalic = new XFont(facename, 20, XFontStyle.BoldItalic);

      // The default alignment is baseline left (that differs from GDI+)
      gfx.DrawString(facename + " (regular)", fontRegular, XBrushes.DarkSlateGray, 0, 30);
      gfx.DrawString(facename + " (bold)", fontBold, XBrushes.DarkSlateGray, 0, 65);
      gfx.DrawString(facename + " (italic)", fontItalic, XBrushes.DarkSlateGray, 0, 100);
      gfx.DrawString(facename + " (bold italic)", fontBoldItalic, XBrushes.DarkSlateGray, 0, 135);
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:18,代码来源:TextStyles3.cs

示例11: Render

        /// <summary>
        /// Renders the content of the page.
        /// </summary>
        public void Render(XGraphics xGraphics)
        {
            const double textPossitionX = 50;
            double textPossitionY = 100;
            const string fontFamilyName = "Times";
            const int fontSizeHeader = 18;
            const int fontSizeText = 12;

            XFont fontHeader = new XFont(fontFamilyName, fontSizeHeader, XFontStyle.Bold);
            XFont fontText = new XFont(fontFamilyName, fontSizeText);
            XFont fontItalic = new XFont(fontFamilyName, fontSizeText, XFontStyle.BoldItalic);
            double lineSpacing = fontText.GetHeight(xGraphics);

            xGraphics.DrawString("This is Header", fontHeader, XBrushes.Black, textPossitionX, textPossitionX);
            textPossitionY += lineSpacing;
            xGraphics.DrawString("This is normal.", fontText, XBrushes.Black, textPossitionX, textPossitionY);
            textPossitionY += lineSpacing;
            xGraphics.DrawString("This is Italic.", fontItalic, XBrushes.Black, textPossitionX, textPossitionY);

            textPossitionY += lineSpacing*3;

            //Bitmap bitmap = (Bitmap)Image.FromFile(@"E:\temp\klicaj.jpeg");
            XImage xImage = null;
            if (item != null)
            {
                if (item.Image != null)
                {
                    MemoryStream memoryStream = new MemoryStream(item.Image);
                    Bitmap bitmap = (Bitmap) Image.FromStream(memoryStream, true, true);
                    xImage = XImage.FromGdiPlusImage(bitmap);
                }
            }

            if (xImage != null)
            {
                XRect rcImage = new XRect(100, textPossitionY, 100, 100*Math.Sqrt(2));
                xGraphics.DrawImage(xImage, rcImage);
            }

            XGraphicsState state = xGraphics.Save();
            xGraphics.Restore(state);
        }
开发者ID:trippleflux,项目名称:jezatools,代码行数:45,代码来源:Renderer.cs

示例12: Draw

 public void Draw(XGraphics gfx)
 {
   string s = "Testtext";
   //gfx.DrawLine(XPens.GreenYellow, 5, 100, 30, 50);
   //gfx.DrawEllipse(XBrushes.DarkBlue, new XRect(30, 40, 250, 235));
   XFont font = new XFont("Arial", 40, XFontStyle.Italic);
   gfx.DrawString(s, font, XBrushes.Firebrick, 40, 60);
   XSize size = gfx.MeasureString(s, font);
   gfx.DrawLine(XPens.DarkBlue, 40, 60, 40 + size.Width, 60);
   gfx.DrawLine(XPens.DarkBlue, 40, 60, 40, 60 + size.Height);
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:11,代码来源:UserControl1.xaml.cs

示例13: DrawTitle

    /// <summary>
    /// Draws the page title and footer.
    /// </summary>
    public void DrawTitle(PdfPage page, XGraphics gfx, string title)
    {
      XRect rect = new XRect(new XPoint(), gfx.PageSize);
      rect.Inflate(-10, -15);
      XFont font = new XFont("Verdana", 14, XFontStyle.Bold);
      gfx.DrawString(title, font, XBrushes.MidnightBlue, rect, XStringFormats.TopCenter);

      rect.Offset(0, 5);
      font = new XFont("Verdana", 8, XFontStyle.Italic);
      XStringFormat format = new XStringFormat();
      format.Alignment = XStringAlignment.Near;
      format.LineAlignment = XLineAlignment.Far;
      gfx.DrawString("Created with " + PdfSharp.ProductVersionInfo.Producer, font, XBrushes.DarkOrchid, rect, format);

      font = new XFont("Verdana", 8);
      format.Alignment = XStringAlignment.Center;
      gfx.DrawString(Program.s_document.PageCount.ToString(), font, XBrushes.DarkOrchid, rect, format);

      Program.s_document.Outlines.Add(title, page, true);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:23,代码来源:Base.cs

示例14: RenderPage

    public override void RenderPage(XGraphics gfx)
    {
      //base.RenderPage(gfx);

      XFont font1 = new XFont("Times New Roman", 12);
      XFont font2 = new XFont("Courier New", 10, XFontStyle.Bold);

      gfx.WriteComment("Word 11");
      gfx.DrawString("Word 11", font1, XBrushes.Black, new XPoint(50, 100));

      gfx.WriteComment("Word 12");
      gfx.DrawString("Word 12", font1, XBrushes.Black, new XPoint(100, 100));


      gfx.WriteComment("Word 21");
      gfx.DrawString("Word 21", font2, XBrushes.Black, new XPoint(50, 200));

      gfx.WriteComment("Word 22");
      gfx.DrawString("Word 22", font2, XBrushes.Black, new XPoint(100, 200));

      gfx.WriteComment("Word 23");
      gfx.DrawString("Word 22", font2, XBrushes.Red, new XPoint(150, 200));

      gfx.WriteComment("Word 24");
      gfx.DrawString("Word 24", font2, XBrushes.Red, new XPoint(200, 200));

    }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:27,代码来源:RealizeTest.cs

示例15: DrawText

    /// <summary>
    /// Draws text in different styles.
    /// </summary>
    void DrawText(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "Text Styles");

      const string facename = "Times New Roman";

      //XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
      XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.WinAnsi, PdfFontEmbedding.Default);

      XFont fontRegular = new XFont(facename, 20, XFontStyle.Regular, options);
      XFont fontBold = new XFont(facename, 20, XFontStyle.Bold, options);
      XFont fontItalic = new XFont(facename, 20, XFontStyle.Italic, options);
      XFont fontBoldItalic = new XFont(facename, 20, XFontStyle.BoldItalic, options);

      // The default alignment is baseline left (that differs from GDI+)
      gfx.DrawString("Times (regular)", fontRegular, XBrushes.DarkSlateGray, 0, 30);
      gfx.DrawString("Times (bold)", fontBold, XBrushes.DarkSlateGray, 0, 65);
      gfx.DrawString("Times (italic)", fontItalic, XBrushes.DarkSlateGray, 0, 100);
      gfx.DrawString("Times (bold italic)", fontBoldItalic, XBrushes.DarkSlateGray, 0, 135);

      EndBox(gfx);
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:25,代码来源:Text.cs


注:本文中的PdfSharp.Drawing.XGraphics.DrawString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。