[阅读: 411] 2007-03-28 08:19:20
using (Graphics g = Graphics.FromHwnd(this.Handle))
{
g.SmoothingMode = SmoothingMode.HighQuality;
using (GraphicsPath path = new GraphicsPath(FillMode.Alternate))
{
path.AddLine(e.X - 40, e.Y - 40, e.X - 40, e.Y + 40);
path.AddCurve(new Point[] { new Point( e.X - 40, e.Y + 40 ), new Point( e.X - 20, e.Y + 80 ), new Point( e.X + 40, e.Y + 40 ) });
path.AddLine(e.X + 40, e.Y + 40, e.X + 40, e.Y - 40);
path.AddLine(e.X + 40, e.Y - 40, e.X - 40, e.Y - 40);
using (LinearGradientBrush br = new LinearGradientBrush(Rectangle.FromLTRB(e.X - 40, e.Y - 40, e.X + 40, e.Y + 80), Color.Red, Color.Pink, LinearGradientMode.Vertical))
{
g.FillPath(br, path);
}
}
}