private void withoutPedestrianToolStripMenuItem_Click(object sender, EventArgs e) { if (!simulationRunning) { if (rectangleisselected == true) { Crossing mycrossing = new Crossing_withoutPedestarian(workingrect, OurtrafficImages.Images[0], "without-pedestrian"); if (ourtraffic.addCrossing(mycrossing, pointselected)) { OurTrafficPBox.Invalidate(); } else { MessageBox.Show("the selected area have crossing, please select other place"); } // OurTrafficPBox.Refresh(); } else { MessageBox.Show("select a place first"); } } else { MessageBox.Show("Simulation is Running,Stop it First"); } }
private void btn_remove_Click(object sender, EventArgs e) { if (!simulationRunning) { if (rectangleisselected == true) { for (int x = 0; x < ourtraffic.traficsrossings.Count; x++) { if (ourtraffic.removeCrossing(workingrect.Location)) { OurTrafficPBox.Invalidate(); } else { MessageBox.Show("there is no crossing in this area!"); } } } else { MessageBox.Show("select a crossing first!!"); } } else { MessageBox.Show("Simulation is Running,Stop it First"); } }
private void OurTrafficPBox_MouseClick(object sender, MouseEventArgs e) { ptclicked.X = e.X; ptclicked.Y = e.Y; pointselected = Findpos(); workingrect = ourtraffic.getRectangle(pointselected); rectangleisselected = true; OurTrafficPBox.Invalidate(); // OurTrafficPBox.Refresh(); }
private void timer1_Tick(object sender, EventArgs e) { ourtraffic.startSimulation(index); OurTrafficPBox.Invalidate(); }