public object Clone() { PaTriangleDef pt = new PaTriangleDef(); for (int i = 0; i < 3; i++) { pt.points[i] = this.points[i]; pt.dx[i] = this.dx[i]; pt.dy[i] = this.dy[i]; } pt.color = this.color; pt.dr = this.dr; pt.dg = this.dg; pt.db = this.db; return(pt); }
public void PaTriangle2016CS20_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; for (int i = 0; i < nCount; i++) { if (i == 3) { pts_t = (PaTriangleDef)pts.Clone(); } pen.Color = Color.FromArgb(pts.color.R * i / nCount, pts.color.G * i / nCount, pts.color.B * i / nCount); //pen.Color = Color.FromArgb(255*i/nCount, pts.color); // 使用 Alpha 通道CPU占用率很高 g.DrawLines(pen, pts.points); g.DrawLine(pen, pts.points[0], pts.points[2]); PA_DoTriangleMoveItem(); } pts = (PaTriangleDef)pts_t.Clone(); PA_DoTriangleNextColor(); }