private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
GraphicsPath gp = new GraphicsPath(); gp.AddLine(, , , );
gp.AddLine(, , , );
gp.AddLine(, , , );
gp.CloseFigure(); g.FillRectangle(Brushes.White,this.ClientRectangle);
g.SmoothingMode = SmoothingMode.AntiAlias; //反锯齿 PathGradientBrush pgb = new PathGradientBrush(gp);
pgb.CenterColor = Color.White;
pgb.SurroundColors = new Color[]
{
Color.Blue
};
g.FillPath(pgb,gp);
g.DrawPath(Pens.Black,gp);
pgb.Dispose();
gp.Dispose();
}

GraphicsPath:可以添加自定义的由一系列相互连接的直线、曲线连接起来组成的开放(非闭合)图形。
   创建路径时就会隐式创建一个新图形(由上面的直线、曲线等组成)

05-11 16:02