C#图形区域剪切的实现方法
本文实例讲述了C#图形区域剪切的实现方法。分享给大家供大家参考。具体如下:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Drawing.Drawing2D;
namespaceadvanced_drawing
{
publicpartialclassForm16:Form
{
publicForm16()
{
InitializeComponent();
}
privatevoidForm16_Paint(objectsender,PaintEventArgse)
{
Graphicsg=e.Graphics;
GraphicsPathpath=newGraphicsPath();
path.AddEllipse(this.ClientRectangle);
Regionregoin=newRegion(path);
g.DrawPath(Pens.Red,path);
g.Clip=regoin;
Rectanglerect=this.ClientRectangle;
rect.Offset(10,10);
rect.Width-=20;
rect.Height-=20;
g.FillRectangle(Brushes.Black,rect);
g.DrawString("zhuzhao",this.Font,Brushes.Blue,100,100);
}
}
}
希望本文所述对大家的C#程序设计有所帮助。
热门推荐
10 邮政贺卡生日祝福语简短
11 生日酒宴诗句祝福语简短
12 朋友古言祝福语简短
13 致同事升迁祝福语简短
14 欢天喜地盖新房祝福语简短
15 祝福语简短大全微信
16 空军婚礼祝福语简短
17 旅行前祝福语简短英语
18 写夏至的祝福语简短