private void panel1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.Clear(Color.White); Random rand = new Random(); Pen border = new Pen(new SolidBrush(Color.Black), 1); Pen cborder = new Pen(new SolidBrush(Color.Black), 2); foreach (Coordinate c in coordinates) { Point p = C2P(c); if (processor != null) { Int32 assignment = processor.GetClusterIndex(c); if (assignment > 0) { g.FillEllipse(new SolidBrush(colors[assignment % colors.Length]), p.X - radius, p.Y - radius, radius * 2, radius * 2); } } g.DrawEllipse(border, p.X - radius, p.Y - radius, radius * 2, radius * 2); } if (processor != null) { foreach (Coordinate c in processor.Centroids) { Point p = C2P(c); int r = 8; g.FillRectangle(new SolidBrush(Color.OrangeRed), p.X - r, p.Y - r, 2 * r, 2 * r); g.DrawRectangle(cborder, p.X - r, p.Y - r, r * 2, r * 2); } } }