예제 #1
0
파일: frmBoard.cs 프로젝트: rborsini/tsp
        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);
            }
        }
예제 #2
0
파일: frmBoard.cs 프로젝트: rborsini/tsp
        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);
        }