/// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         components.Dispose();
     }
     RenderFont.Dispose();
     base.Dispose(disposing);
 }
Example #2
0
 public void BitBlt(string str, Rectangle rect, Color color, int width, int height, string ZiTi = "宋体")
 {
     //_Font.RenderText("BakaBakaBakaBakaBaka", new SharpDX.Mathematics.Interop.RawRectangle(0, 0, 105, 100), SharpDX.Color.LightSkyBlue);
     if (_Font != null)
     {
         _Font.Dispose();
     }
     _Font = new RenderFont(_Engine, ZiTi, width, height);
     _Font.RenderText(str, new SharpDX.Mathematics.Interop.RawRectangle(rect.X, rect.Y, rect.Right, rect.Bottom),
                      color);
 }
Example #3
0
 /// <summary>
 /// Returns a <see cref="RenderFont" /> as a <see cref="Font" />.
 /// </summary>
 /// <param name="renderFont">The render font.</param>
 /// <returns>
 /// The <see cref="Font" /> corresponding to the <see cref="RenderFont" />.
 /// </returns>
 public static Font AsFont(this RenderFont renderFont)
 => new Font(
     renderFont.FamilyName,
     renderFont.SizeInPoints,
     (renderFont.Bold ? FontStyle.Bold : FontStyle.Regular) & (renderFont.Italic ? FontStyle.Italic : FontStyle.Regular) & (renderFont.Strikeout ? FontStyle.Strikeout : FontStyle.Regular) & (renderFont.Underline ? FontStyle.Underline : FontStyle.Regular),
     GraphicsUnit.Point);