当前位置: 移动技术网 > IT编程>开发语言>c# > C#中GraphicsPath的AddString方法用法实例

C#中GraphicsPath的AddString方法用法实例

2019年07月18日  | 移动技术网IT编程  | 我要评论
本文实例讲述了c#中graphicspath的addstring方法用法。分享给大家供大家参考。具体如下: using system; using system

本文实例讲述了c#中graphicspath的addstring方法用法。分享给大家供大家参考。具体如下:

using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.text;
using system.windows.forms;
using system.drawing.drawing2d;
namespace advanced_drawing
{
  public partial class form14 : form
  {
    public form14()
    {
      initializecomponent();
    }
    private void form14_paint(object sender, painteventargs e)
    {
      // create a graphicspath object.
      graphicspath mypath = new graphicspath();
      // set up all the string parameters.
      string stringtext = "sample text";
      fontfamily family = new fontfamily("arial");
      int fontstyle = (int)fontstyle.italic;
      int emsize = 26;
      point origin = new point(20, 20);
      stringformat format = stringformat.genericdefault;
      // add the string to the path.
      mypath.addstring(stringtext,
        family,
        fontstyle,
        emsize,
        origin,
        format);
      //draw the path to the screen.
      e.graphics.fillpath(brushes.black, mypath);
    }
  }
}

希望本文所述对大家的c#程序设计有所帮助。

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网