예제 #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));
 }