private void btnRandom_Click(object sender, EventArgs e) { Clear(); Random r = new Random(); for(int i = 0; i < Convert.ToInt32(this.numericUpDown.Value); i++) { Tsp.Point point = new Tsp.Point(); point.Name = (i + 1).ToString(); point.X = Convert.ToInt32(r.NextDouble() * 500); point.Y = Convert.ToInt32(r.NextDouble() * 500); AddPoint(point); } }
private void pnlBoard_Click(object sender, EventArgs e) { Tsp.Point point = new Tsp.Point(); MouseEventArgs arg = (MouseEventArgs)e; point.Name = (this.points.Count + 1).ToString(); point.X = Convert.ToInt32(arg.X); point.Y = Convert.ToInt32(arg.Y); AddPoint(point); }