C#中GraphicsPath的AddString方法用法实例
本文实例讲述了C#中GraphicsPath的AddString方法用法。分享给大家供大家参考。具体如下:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Drawing.Drawing2D;
namespaceadvanced_drawing
{
publicpartialclassForm14:Form
{
publicForm14()
{
InitializeComponent();
}
privatevoidForm14_Paint(objectsender,PaintEventArgse)
{
//CreateaGraphicsPathobject.
GraphicsPathmyPath=newGraphicsPath();
//Setupallthestringparameters.
stringstringText="SampleText";
FontFamilyfamily=newFontFamily("Arial");
intfontStyle=(int)FontStyle.Italic;
intemSize=26;
Pointorigin=newPoint(20,20);
StringFormatformat=StringFormat.GenericDefault;
//Addthestringtothepath.
myPath.AddString(stringText,
family,
fontStyle,
emSize,
origin,
format);
//Drawthepathtothescreen.
e.Graphics.FillPath(Brushes.Black,myPath);
}
}
}
希望本文所述对大家的C#程序设计有所帮助。
热门推荐
10 祝父母节日祝福语简短
11 姐妹结婚红包简短祝福语
12 祝福语简短唯美10字
13 同学朋友吃饭祝福语简短
14 团队入伙简短祝福语大全
15 美国护士毕业祝福语简短
16 祝产妇的祝福语简短
17 毕业离别祝福语简短老师
18 给红包祝福语简短搞笑