2011-07-15 29 views

答えて

0

それぞれの文字を個別に描画し、文字間の距離などを調整できます。

public void DrawText(string text, Point at, float distanceBetweenChars, FontFamily fontFamily, float fontSize, Graphics graphics) 
{ 
    float currentX = at.X; 
    for (int i = 0; i < text.Length; i++) 
    { 
     using (var path = new GraphicsPath()) 
     { 
      path.AddString(text.Substring(i, 1), fontFamily, (int)FontStyle.Regular, fontSize, 
           new Point((int)currentX, at.Y), 
           StringFormat.GenericDefault); 
       RectangleF bounds = path.GetBounds(); 
       currentX += bounds.Width + distanceBetweenChars; 
       graphics.FillPath(new SolidBrush(Color.Black), path); 
      } 
     } 
    } 
} 
関連する問題