110,499
社区成员
发帖
与我相关
我的任务
分享
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
GraphicsPath gp = new GraphicsPath();
const int width = 100;
Point[] pt = { new Point(300,300), new Point(100,100), new Point(110,80) };
Pen p = new Pen(Color.FromArgb(0x80, Color.Navy), width);
Pen p1 = new Pen(Color.FromArgb(0x80, Color.Red), width);
Pen p2 = new Pen(Color.Black);
Pen p3 = new Pen(Color.FromArgb(0x80, Color.Black), 8);
//using(p)
{
p3.EndCap = LineCap.ArrowAnchor;
p.LineJoin = LineJoin.Round;
gp.AddLines(pt);
g.DrawLine(p3, pt[0], pt[1]);
g.DrawLine(p3, pt[1], pt[2]);
g.DrawRectangle(p2, pt[0].X, pt[0].Y, 2, 2);
g.DrawRectangle(p2, pt[1].X, pt[1].Y, 2, 2);
g.DrawRectangle(p2, pt[2].X, pt[2].Y, 2, 2);
// (1)
g.DrawLine(p1, pt[0], pt[1]);
g.DrawLine(p1, pt[1], pt[2]);
// (2)
//g.DrawPath(p, gp);
}
//base.OnPaint(e);
}