private void button2_Click(object sender, EventArgs e) { string Name = Convert.ToString(this.nameStation.Text); Station entStn = Station.SearchByName(Name); if (entStn == null) { int X = Convert.ToInt32(this.xStation.Text); int Y = Convert.ToInt32(this.yStation.Text); Station Stn = new Station(Name, X, Y); } FormEditRoute_Activated(sender, e); nameStation_TextChanged(sender, e); }
/// <summary> /// Рисует одну станцию. /// </summary> /// <param name="station">Станция, которую нужно нарисовать.</param> /// <param name="e"></param> private void DrawStation(Station station, Graphics g) { g.FillEllipse(brushStation, station.X, station.Y, radiusStation * 2, radiusStation * 2); g.DrawEllipse(penStation, station.X, station.Y, radiusStation * 2, radiusStation * 2); PointF p = new Point(station.X + radiusStation * 2, station.Y + radiusStation*2); g.DrawString(station.Name, Font, SystemBrushes.WindowText, p); }
/// <summary> /// Добавляет данные о местоположениях станций в программу. /// </summary> /// <param name="Stations">Список узлов типа Location.</param> private static void LoadStations(XmlNodeList Stations) { foreach(XmlNode Stn in Stations) { string name = Stn.ChildNodes[0].InnerText; int x = Convert.ToInt32(Stn.ChildNodes[1].InnerText); int y = Convert.ToInt32(Stn.ChildNodes[2].InnerText); Station Station = new Station(name, x, y); } }