realizetest.cs

来自「用C#實現能產生PDF格式文件的源碼」· CS 代码 · 共 51 行

CS
51
字号
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using PdfSharp.Drawing;

namespace XDrawing.TestLab.Tester
{
  /// <summary>
  /// Checks some internal optimizations in PDF creation.
  /// </summary>
  public class RealizeTest : TesterBase
  {
    public RealizeTest()
    {
    }

    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, Brushes.Black, new XPoint(50, 100));

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


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

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

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

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

    }

    public override string Description
    {
      get {return "DrawString";}
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?