示例#1
0
 public SizeF MeasureString(string text, DUIFont font, float width, float height)
 {
     if (string.IsNullOrWhiteSpace(text))
     {
         return(SizeF.Empty);
     }
     return(this.iDUIGraphics.MeasureString(text, font, width, height));
 }
示例#2
0
 public void DrawString(string s, DUIFont font, DUIBrush brush, RectangleF layoutRectangle, StringFormat format)
 {
     if (string.IsNullOrWhiteSpace(s))
     {
         return;
     }
     this.iDUIGraphics.DrawString(s, font, brush, layoutRectangle, format);
 }
示例#3
0
 public SizeF MeasureString(string text, DUIFont font, float width, float height)
 {
     using (SharpDX.DirectWrite.TextLayout tl = DxConvert.ToTextLayout(font, text))
     {
         float w = tl.Metrics.WidthIncludingTrailingWhitespace;
         float h = tl.Metrics.Height;
         return(new SizeF(w, h));
     }
 }
示例#4
0
 public void DrawString(string s, DUIFont font, DUIBrush brush, RectangleF layoutRectangle, StringFormat format)
 {
     brush.RenderTarget = this.target;
     try
     {
         this.target.RenderTarget.DrawText(s, font, DxConvert.ToRectF(new RectangleF(layoutRectangle.X, layoutRectangle.Y, float.MaxValue, 0)), brush);
     }
     catch (Exception ex)
     {
         Log.DUILog.GettingLog(ex);
         //这里报错率很高,但不知道为什么
     }
 }
示例#5
0
 public void DrawString(string s, DUIFont font, DUIBrush brush, RectangleF layoutRectangle, StringFormat format)
 {
     this.graphics.DrawString(s, font, brush, layoutRectangle, format);
 }
示例#6
0
 public SizeF MeasureString(string text, DUIFont font, float width, float height)
 {
     return(this.graphics.MeasureString(text, font, new SizeF(width, height)));
 }
示例#7
0
 public void DrawString(string s, DUIFont font, DUIBrush brush, float x, float y)
 {
     DrawString(s, font, brush, new RectangleF(new PointF(x, y), MeasureString(s, font)), StringFormat.GenericDefault);
 }
示例#8
0
 public void DrawString(string s, DUIFont font, DUIBrush brush, PointF p)
 {
     DrawString(s, font, brush, p.X, p.Y);
 }
示例#9
0
 public SizeF MeasureString(string text, DUIFont font, SizeF size)
 {
     return(this.MeasureString(text, font, size.Width, size.Height));
 }
示例#10
0
 public SizeF MeasureString(string text, DUIFont font)
 {
     return(this.MeasureString(text, font, float.MaxValue, 0));
 }
示例#11
0
 public static SharpDX.DirectWrite.TextLayout ToTextLayout(DUIFont font, string text)
 {
     return(new SharpDX.DirectWrite.TextLayout(directWriteFactory, text, font, float.MaxValue, 0));
 }