C#使用Region对图形区域构造和填充的方法
本文实例讲述了C#使用Region对图形区域构造和填充的方法。分享给大家供大家参考。具体如下:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Drawing.Drawing2D;
namespaceadvanced_drawing
{
publicpartialclassForm15:Form
{
publicForm15()
{
InitializeComponent();
}
privatevoidForm15_Paint(objectsender,PaintEventArgse)
{
GraphicsPathmyPath=newGraphicsPath();
stringstringText="zhuzhao";
FontFamilyfamily=newFontFamily("Arial");
intfontStyle=(int)FontStyle.Italic;
intemSize=26;
Pointorigin=newPoint(20,20);
StringFormatformat=StringFormat.GenericDefault;
myPath.AddString(stringText,family,fontStyle,emSize,origin,format);
Regionregion=newRegion(myPath);
e.Graphics.FillRegion(Brushes.Red,region);
}
}
}
希望本文所述对大家的C#程序设计有所帮助。
热门推荐
10 培训机构升班祝福语简短
11 毕业教师花语祝福语简短
12 广场周年庆祝福语 简短
13 同事生日祝福语简短独特
14 发文章祝福语简短英语
15 答谢生子祝福语简短独特
16 厂庆祝福语大全简短
17 简短新年红包祝福语大全
18 祝贺员工结婚祝福语简短