/// User clicked a point on the city map. /// As long as we aren't running the TSP algorithm, /// place a new city on the map and add it to the city list. private void tourDiagram_MouseDown(object sender, MouseEventArgs e) { if (tsp != null) { StatusLabel.Text = "Cannot alter city list while running"; StatusLabel.ForeColor = Color.Red; return; } cityList.Add(new City(e.X, e.Y)); DrawCityList(cityList); }
/// <summary> /// User clicked a point on the city map. /// As long as we aren't running the TSP algorithm, /// place a new city on the map and add it to the city list. /// </summary> /// <param name="sender">Object that generated this event.</param> /// <param name="e">Event arguments.</param> private void tourDiagram_MouseDown(object sender, MouseEventArgs e) { if (tsp != null) { StatusLabel.Text = "Невозможно добавить город во время работы"; StatusLabel.ForeColor = Color.Red; return; } cityList.Add(new City(e.X, e.Y)); DrawCityList(cityList); }
/// <summary> /// User clicked a point on the city map. /// As long as we aren't running the TSP algorithm, /// place a new city on the map and add it to the city list. /// </summary> /// <param name="sender">Object that generated this event.</param> /// <param name="e">Event arguments.</param> private void tourDiagram_MouseDown(object sender, MouseEventArgs e) { if (tsp != null) { StatusLabel.Text = "Нельзя изменить список городов во время работы программы."; StatusLabel.ForeColor = Color.Red; return; } cityList.Add(new City(e.X, e.Y)); DrawCityList(cityList); }
/// <summary> /// User clicked a point on the city map. /// As long as we aren't running the TSP algorithm, /// place a new city on the map and add it to the city list. /// </summary> /// <param name="sender">Object that generated this event.</param> /// <param name="e">Event arguments.</param> private void tourDiagram_MouseDown(object sender, MouseEventArgs e) { int i = 0; if (e.Button == MouseButtons.Left) { if (tsp != null) { StatusLabel.Text = "Невозможно добавить город во время работы"; StatusLabel.ForeColor = Color.Red; return; } foreach (PictureBox pBox in listcity) { tourDiagram.Controls.Remove(listcity[i]); i++; tourDiagram.Update(); } cityList.Add(new City(e.X, e.Y)); this.DrawCityList(cityList); } }