public Station(string name, SizeablePictureBox image) { this.name = name; this.image = image; this.position = new Point(image.Location.X, image.Location.Y); dragMode = false; }
public Obstacle(int id, SizeablePictureBox picture) { this.id = id; this.picture = picture; taille = picture.Size; this.position = new Point(picture.Location.X, picture.Location.Y); }
public AccesPoint(string nom, float puissance, SizeablePictureBox image, Color couleur) { dragMode = false; this.nom = nom; this.puissance = puissance; this.image = image; this.couluer = couluer; rayon = (float)(1.666 * puissance + 83.334); centre = new Point(this.image.Location.X + this.image.Width / 2, this.image.Location.Y + this.image.Height / 2); this.couverture = new Couverture(centre, rayon, couleur); }
private void Track_Assign_Load(object sender, EventArgs e) { allbits = Simulation.unique_bits.ToArray(); comboBox1.Items.AddRange(allbits); comboBox2.Items.AddRange(allbits); comboBox3.Items.AddRange(allbits); comboBox4.Items.AddRange(allbits); comboBox5.Items.AddRange(allbits); comboBox6.Items.AddRange(allbits); comboBox7.Items.AddRange(allbits); comboBox8.Items.AddRange(allbits); comboBox9.Items.AddRange(allbits); comboBox9.Items.AddRange(allbits); comboBox10.Items.AddRange(allbits); comboBox11.Items.AddRange(allbits); comboBox13.Items.AddRange(allbits); comboBox15.Items.AddRange(allbits); comboBox16.Items.AddRange(allbits); comboBox17.Items.AddRange(allbits); namebit = Form2.knowbit; SizeablePictureBox pb = (SizeablePictureBox)namebit; if (pb.Bitsofcomponents != null) { string[] tagget = (string[])pb.Bitsofcomponents; // string[] tagget = pb.Tag.ToString(); comboBox1.Text = tagget[0]; comboBox2.Text = tagget[1]; comboBox3.Text = tagget[2]; comboBox4.Text = tagget[3]; comboBox5.Text = tagget[4]; comboBox6.Text = tagget[5]; comboBox7.Text = tagget[6]; comboBox8.Text = tagget[7]; comboBox9.Text = tagget[8]; comboBox10.Text = tagget[9]; comboBox11.Text = tagget[10]; comboBox12.Text = tagget[11]; comboBox13.Text = tagget[12]; comboBox14.Text = tagget[13]; comboBox15.Text = tagget[14]; comboBox16.Text = tagget[15]; comboBox17.Text = tagget[16]; } return; }
public void painting(object obj) { SizeablePictureBox pb1 = (SizeablePictureBox)obj; pb1.Tag = (string[])pb1.Tag; string[] trk = (string[])pb1.Tag; switch (trk[1]) { case "trk180": pb1.Paint += new PaintEventHandler(paintfortrack); break; } string[] twosignal = (string[])pb1.Tag; switch (twosignal[1]) { case "TH_W_signal": pb1.Paint += new PaintEventHandler(TH_W_Signal_Paint); break; } string[] onesignal = (string[])pb1.Tag; switch (onesignal[1]) { case "OH_E_Signal": pb1.Paint += new PaintEventHandler(OH_E_Signal_Paint); break; } string[] switches = (string[])pb1.Tag; switch (switches[1]) { case "SwitchBL": pb1.Paint += new PaintEventHandler(Switch_BL_Paint); break; } }
public string[] whichcomponent(object obj) { SizeablePictureBox pb = (SizeablePictureBox)obj; List <string> bitval = new List <string>(); pb.Tag = (string[])pb.Tag; string[] trk = (string[])pb.Tag; switch (trk[1]) { case "trk180": if (pb.Bitsofcomponents[2] != null && pb.Bitsofcomponents[2] != "") { if (pb.Bitsofcomponents[2] == "A") { otherbits[0] = "C"; otherbits[1] = "E"; } else if (pb.Bitsofcomponents[2] == "C") { otherbits[0] = "E"; otherbits[1] = "A"; } else if (pb.Bitsofcomponents[2] == "E") { otherbits[0] = "C"; otherbits[1] = "A"; } } break; } string[] twosignal = (string[])pb.Tag; switch (twosignal[1]) { case "TH_W_signal": if (pb.Bitsofcomponents[6] != null && pb.Bitsofcomponents[6] != "") { if (pb.Bitsofcomponents[6] == "A") { otherbits[0] = "C"; otherbits[1] = "E"; } else if (pb.Bitsofcomponents[6] == "C") { otherbits[0] = "E"; otherbits[1] = "A"; } else if (pb.Bitsofcomponents[6] == "E") { otherbits[0] = "C"; otherbits[1] = "A"; } } break; } string[] onesignal = (string[])pb.Tag; switch (onesignal[1]) { case "OH_E_Signal": if (pb.Bitsofcomponents[6] != null && pb.Bitsofcomponents[6] != "") { if (pb.Bitsofcomponents[6] == "A") { otherbits[0] = "C"; otherbits[1] = "E"; } else if (pb.Bitsofcomponents[6] == "C") { otherbits[0] = "E"; otherbits[1] = "A"; } else if (pb.Bitsofcomponents[6] == "E") { otherbits[0] = "C"; otherbits[1] = "A"; } } break; } string[] switches = (string[])pb.Tag; switch (switches[1]) { case "SwitchBL": if (pb.Bitsofcomponents[6] != null && pb.Bitsofcomponents[6] != "") { if (pb.Bitsofcomponents[6] == "A") { otherbits[0] = "C"; otherbits[1] = "E"; } else if (pb.Bitsofcomponents[6] == "C") { otherbits[0] = "E"; otherbits[1] = "A"; } else if (pb.Bitsofcomponents[6] == "E") { otherbits[0] = "C"; otherbits[1] = "A"; } } break; } return(otherbits); }
//comboBox1.Items.Add private void button1_Click(object sender, EventArgs e) { namebit = Form2.knowbit; SizeablePictureBox pb = (SizeablePictureBox)namebit; List <string> refconver = new List <string>(); if (comboBox1.SelectedItem != null) { refconver.Add(comboBox1.SelectedItem.ToString()); } else { refconver.Add(""); } if (comboBox2.SelectedItem != null) { refconver.Add(comboBox2.SelectedItem.ToString()); } else { refconver.Add(""); } if (comboBox3.SelectedItem != null) { refconver.Add(comboBox3.SelectedItem.ToString()); } else { refconver.Add(""); } if (comboBox4.SelectedItem != null) { refconver.Add(comboBox4.SelectedItem.ToString()); } else { refconver.Add(""); } if (comboBox5.SelectedItem != null) { refconver.Add(comboBox5.SelectedItem.ToString()); } else { refconver.Add(""); } if (comboBox6.SelectedItem != null) { refconver.Add(comboBox6.SelectedItem.ToString()); } else { refconver.Add(""); } if (comboBox7.SelectedItem != null) { refconver.Add(comboBox7.SelectedItem.ToString()); } else { refconver.Add(""); } if (comboBox8.SelectedItem != null) { refconver.Add(comboBox8.SelectedItem.ToString()); } else { refconver.Add(""); } if (comboBox9.SelectedItem != null) { refconver.Add(comboBox9.SelectedItem.ToString()); } else { refconver.Add(""); } pb.Bitsofcomponents = refconver.ToArray(); List <string> placeforval = new List <string>(); for (int i = 0; i < pb.Bitsofcomponents.Length; i++) { if (Form2.Bitsref.ContainsKey(pb.Bitsofcomponents[i])) { Form2.Bitsref.TryGetValue(pb.Bitsofcomponents[i], out forvalbit); placeforval.Add(forvalbit); } else { placeforval.Add(""); } } pb.Componentval = placeforval.ToArray(); this.Close(); }
private void Track_Assign_Load(object sender, EventArgs e) { allbits = Simulation.unique_bits.ToArray(); comboBox1.Items.AddRange(allbits); comboBox2.Items.AddRange(allbits); comboBox3.Items.AddRange(allbits); comboBox4.Items.AddRange(allbits); comboBox5.Items.AddRange(allbits); namebit = Form2.knowbit; SizeablePictureBox pb = (SizeablePictureBox)namebit; if (pb.Bitsofcomponents != null) { string[] tagget = (string[])pb.Bitsofcomponents; // string[] tagget = pb.Tag.ToString(); comboBox1.Text = tagget[0]; comboBox2.Text = tagget[1]; comboBox3.Text = tagget[2]; comboBox4.Text = tagget[3]; comboBox5.Text = tagget[4]; } }
private void Switch_BL_Paint(object sender, PaintEventArgs e) { Rectangle rect14 = new Rectangle(); // Horizontal Track rect14.Location = new Point(0, 35); rect14.Width = 10000; rect14.Height = 1; /* if (Form2.mouseenter == true ) * { * * SizeablePictureBox pb1 = (SizeablePictureBox)sender; * Rectangle rect5 = new Rectangle(); * rect5.Location = new Point(0, 0); * rect5.Width = 5; * rect5.Height = 5; * * Rectangle rect6 = new Rectangle(); * rect6.Location = new Point(pb1.ClientRectangle.Width - 5, 0); * rect6.Width = 5; * rect6.Height = 5; * * Rectangle rect7 = new Rectangle(); * rect7.Location = new Point(0, pb1.ClientRectangle.Height - 5); * rect7.Width = 5; * rect7.Height = 5; * * Rectangle rect1 = new Rectangle(); * rect1.Location = new Point(pb1.ClientRectangle.Width - 5, pb1.ClientRectangle.Height - 5); * rect1.Width = 5; * rect1.Height = 5; * e.Graphics.FillRectangle(Brushes.White, rect5); * e.Graphics.FillRectangle(Brushes.White, rect6); * e.Graphics.FillRectangle(Brushes.White, rect7); * e.Graphics.FillRectangle(Brushes.White, rect1); * * }*/ Pen whitePen = new Pen(Color.White, 1); // Angled Track e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.FillRectangle(Brushes.White, rect14); e.Graphics.DrawLine(whitePen, 0, 105, 50, 45); // Angled Track Draw SizeablePictureBox pb = (SizeablePictureBox)sender; if (pb.Componentval != null) { if (pb.Componentval[6] == "1") { e.Graphics.FillRectangle(Brushes.Red, rect14); // Pen redPen = new Pen(Color.Red, 1); // e.Graphics.DrawLine(redPen, 0, 105, 50, 45); } if (pb.Componentval[13] == "1") { SizeablePictureBox pb1 = (SizeablePictureBox)sender; pb1.Invalidate(); Rectangle rect15 = new Rectangle(); // Horizontal Track rect15.Location = new Point(0, 35); rect15.Width = 5000; rect14.Height = 1; Rectangle rect16 = new Rectangle(); // Horizontal Track rect16.Location = new Point(rect15.Width + 20, 35); rect16.Width = 5000; rect14.Height = 1; e.Graphics.FillRectangle(Brushes.Red, rect15); e.Graphics.FillRectangle(Brushes.Red, rect16); Pen white1Pen = new Pen(Color.White, 1); // Angled Track e.Graphics.DrawLine(white1Pen, 0, 105, 50, 45); // Angled Track Draw } } }
private void OH_E_Signal_Paint(object sender, PaintEventArgs e) { Rectangle rect = new Rectangle(); //Lamp 1 rect.Location = new Point(27, 45); rect.Width = 14; rect.Height = 14; Rectangle rect1 = new Rectangle(); //Mast rect1.Location = new Point(12, 52); rect1.Width = 15; rect1.Height = 1; Rectangle rect2 = new Rectangle(); //IJ rect2.Location = new Point(0, 30); rect2.Width = 1; rect2.Height = 12; Rectangle rect3 = new Rectangle(); //Track rect3.Location = new Point(0, 35); rect3.Width = 10000; rect3.Height = 1; //Rectangle rect4 = new Rectangle(); //Lamp 2 //rect4.Location = new Point(44, 45); //rect4.Width = 14; //rect4.Height = 14; Rectangle rect5 = new Rectangle(); //Base rect5.Location = new Point(12, 47); rect5.Width = 1; rect5.Height = 12; /* if ( Form2.mouseenter == true) * { * SizeablePictureBox pb1 = (SizeablePictureBox)sender; * Rectangle rect6 = new Rectangle(); * rect6.Location = new Point(0, 0); * rect6.Width = 5; * rect6.Height = 5; * * Rectangle rect7 = new Rectangle(); * rect7.Location = new Point(pb1.ClientRectangle.Width - 5, 0); * rect7.Width = 5; * rect7.Height = 5; * * Rectangle rect8 = new Rectangle(); * rect8.Location = new Point(0, pb1.ClientRectangle.Height - 5); * rect8.Width = 5; * rect8.Height = 5; * * Rectangle rect9 = new Rectangle(); * rect9.Location = new Point(pb1.ClientRectangle.Width - 5, pb1.ClientRectangle.Height - 5); * rect9.Width = 5; * rect9.Height = 5; * e.Graphics.FillRectangle(Brushes.White, rect6); * e.Graphics.FillRectangle(Brushes.White, rect7); * e.Graphics.FillRectangle(Brushes.White, rect8); * e.Graphics.FillRectangle(Brushes.White, rect9); * * }*/ using (Pen pen = new Pen(Color.White, 2)) { e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.DrawEllipse(pen, rect); //e.Graphics.DrawEllipse(pen, rect4); } e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.FillEllipse(Brushes.Black, rect); e.Graphics.FillRectangle(Brushes.White, rect1); e.Graphics.FillRectangle(Brushes.White, rect2); e.Graphics.FillRectangle(Brushes.White, rect3); //e.Graphics.FillEllipse(Brushes.Black, rect4); e.Graphics.FillRectangle(Brushes.White, rect5); if (Form2.copy == false) { SizeablePictureBox pb = (SizeablePictureBox)sender; if (pb.Componentval != null) { if (pb.Componentval[2] == "1") { e.Graphics.FillEllipse(Brushes.Green, rect); } if (pb.Componentval[3] == "1") { e.Graphics.FillEllipse(Brushes.Yellow, rect); } if (pb.Componentval[6] == "1") { e.Graphics.FillRectangle(Brushes.Red, rect3); } if (pb.Componentval[5] == "1") { e.Graphics.FillEllipse(Brushes.Red, rect); } if (pb.Componentval[8] == "1") { e.Graphics.FillEllipse(Brushes.Gray, rect); } } } if (Form2.copy == true) { SizeablePictureBox pb = (SizeablePictureBox)Form2.gl; if (pb.Componentval != null) { if (pb.Componentval[2] == "1") { e.Graphics.FillEllipse(Brushes.Green, rect); } if (pb.Componentval[3] == "1") { e.Graphics.FillEllipse(Brushes.Yellow, rect); } if (pb.Componentval[5] == "1") { e.Graphics.FillEllipse(Brushes.Red, rect); } if (pb.Componentval[6] == "1") { e.Graphics.FillRectangle(Brushes.Red, rect3); } if (pb.Componentval[8] == "1") { e.Graphics.FillEllipse(Brushes.Gray, rect); } } } }
private void paintfortrack(object sender, PaintEventArgs e) { Rectangle rect = new Rectangle(); rect.Location = new Point(0, 35); rect.Height = 1; SizeablePictureBox pb = (SizeablePictureBox)sender; rect.Width = pb.ClientRectangle.Width; e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.FillRectangle(Brushes.White, rect); /* if (Form2.copy == false) * { * SizeablePictureBox pb = (SizeablePictureBox)sender; * rect.Width = pb.ClientRectangle.Width; * * e.Graphics.SmoothingMode = SmoothingMode.HighQuality; * e.Graphics.FillRectangle(Brushes.White, rect); * * * } * if (Form2.copy == true) * { * SizeablePictureBox pb = (SizeablePictureBox)Form2.copypic; * rect.Width = pb.ClientRectangle.Width; * * e.Graphics.SmoothingMode = SmoothingMode.HighQuality; * e.Graphics.FillRectangle(Brushes.White, rect); * }*/ /* if (Form2.mouseenter == true) * { * SizeablePictureBox pb1 = (SizeablePictureBox)sender; * Rectangle rect1 = new Rectangle(); * rect1.Location = new Point(0, 0); * rect1.Width = 5; * rect1.Height = 5; * * Rectangle rect2 = new Rectangle(); * rect2.Location = new Point(pb1.ClientRectangle.Width - 5, 0); * rect2.Width = 5; * rect2.Height = 5; * * Rectangle rect4 = new Rectangle(); * rect4.Location = new Point(0, pb1.ClientRectangle.Height - 5); * rect4.Width = 5; * rect4.Height = 5; * * Rectangle rect5 = new Rectangle(); * rect5.Location = new Point(pb1.ClientRectangle.Width - 5, pb1.ClientRectangle.Height - 5); * rect5.Width = 5; * rect5.Height = 5; * e.Graphics.FillRectangle(Brushes.White, rect1); * e.Graphics.FillRectangle(Brushes.White, rect2); * e.Graphics.FillRectangle(Brushes.White, rect4); * e.Graphics.FillRectangle(Brushes.White, rect5); * * } */ e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //This will be a bit that the user assigns the tracktrain if (Form2.copy == true) { pic = Form2.copypic; } else if (Form2.copy == false) { pic = sender; } SizeablePictureBox pb2 = (SizeablePictureBox)pic; if (pb2.Bitsofcomponents != null) { if (pb2.Componentval[2] == "1") { e.Graphics.FillRectangle(Brushes.Red, rect); } } else { e.Graphics.FillRectangle(Brushes.White, rect); } }
private void TH_W_Signal_Paint(object sender, PaintEventArgs e) { /* if (copy == false) * { * SizeablePictureBox pb = (SizeablePictureBox)sender; * rect.Width = pb.ClientRectangle.Width; * e.Graphics.FillRectangle(Brushes.White, rect); * * * } * if (copy == true) * { * SizeablePictureBox pb = (SizeablePictureBox)gl; * rect.Width = pb.ClientRectangle.Width; * e.Graphics.FillRectangle(Brushes.White, rect); * } */ Rectangle rect8 = new Rectangle(); //Bottom Unit Lamp rect8.Location = new Point(56, 45); rect8.Width = 14; rect8.Height = 14; Rectangle rect9 = new Rectangle(); //Mast rect9.Location = new Point(70, 52); rect9.Width = 15; rect9.Height = 1; Rectangle rect10 = new Rectangle(); //IJ rect10.Location = new Point(98, 30); rect10.Width = 1; rect10.Height = 12; Rectangle rect11 = new Rectangle(); //Track rect11.Location = new Point(0, 35); rect11.Width = 100; rect11.Height = 1; Rectangle rect12 = new Rectangle(); //Top Unit Lamp rect12.Location = new Point(41, 45); rect12.Width = 14; rect12.Height = 14; Rectangle rect13 = new Rectangle(); //Base rect13.Location = new Point(85, 47); rect13.Width = 1; rect13.Height = 12; /* if (Form2.mouseenter == true) * { * SizeablePictureBox pb1 = (SizeablePictureBox)sender; * Rectangle rect5 = new Rectangle(); * rect5.Location = new Point(0, 0); * rect5.Width = 5; * rect5.Height = 5; * * Rectangle rect6 = new Rectangle(); * rect6.Location = new Point(pb1.ClientRectangle.Width - 5, 0); * rect6.Width = 5; * rect6.Height = 5; * * Rectangle rect7 = new Rectangle(); * rect7.Location = new Point(0, pb1.ClientRectangle.Height - 5); * rect7.Width = 5; * rect7.Height = 5; * * Rectangle rect1 = new Rectangle(); * rect1.Location = new Point(pb1.ClientRectangle.Width - 5, pb1.ClientRectangle.Height - 5); * rect1.Width = 5; * rect1.Height = 5; * e.Graphics.FillRectangle(Brushes.White, rect5); * e.Graphics.FillRectangle(Brushes.White, rect6); * e.Graphics.FillRectangle(Brushes.White, rect7); * e.Graphics.FillRectangle(Brushes.White, rect1); * * } */ using (Pen pen = new Pen(Color.White, 2)) { e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.DrawEllipse(pen, rect8); e.Graphics.DrawEllipse(pen, rect12); } SizeablePictureBox pb = (SizeablePictureBox)sender; e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.FillEllipse(Brushes.Black, rect8); e.Graphics.FillRectangle(Brushes.White, rect9); e.Graphics.FillRectangle(Brushes.White, rect10); e.Graphics.FillRectangle(Brushes.White, rect11); e.Graphics.FillEllipse(Brushes.Black, rect12); e.Graphics.FillRectangle(Brushes.White, rect13); if (pb.Componentval != null) { if (pb.Componentval[6] == "1") { e.Graphics.FillRectangle(Brushes.Red, rect11); } if (pb.Componentval[2] == "1") { e.Graphics.FillEllipse(Brushes.Green, rect12); } if (pb.Componentval[3] == "1") { e.Graphics.FillEllipse(Brushes.Yellow, rect12); } if (pb.Componentval[5] == "1") { e.Graphics.FillEllipse(Brushes.Red, rect12); } if (pb.Componentval[8] == "1") { e.Graphics.FillEllipse(Brushes.Gray, rect12); } if (pb.Componentval[16] == "1") { e.Graphics.FillEllipse(Brushes.Green, rect8); } if (pb.Componentval[14] == "1") { e.Graphics.FillEllipse(Brushes.Yellow, rect8); } if (pb.Componentval[12] == "1") { e.Graphics.FillEllipse(Brushes.Red, rect8); } if (pb.Componentval[10] == "1") { e.Graphics.FillEllipse(Brushes.Gray, rect8); } } }