private void AgregarDetector_btn_Click(object sender, EventArgs e) { Program.SizeInPX = 25; Program.TagName = ""; Program.Identificador = ""; Program.Gdispositivo = ""; Program.GtipoDispositivo = ""; Program.Gfigura = ""; NameZoneForm form = new NameZoneForm(); form.ShowDialog(); if (Program.TagName != "") { if (Program.Gfigura == "Letra P") { GenerarDetectorZona(200, 5, "NEW", Program.SizeInPX, Program.TagName, true, 0, Properties.Resources.transLetraPverde, Program.Identificador, Program.Gdispositivo, Program.Gdispositivo, Program.Gfigura); } else { GenerarDetectorZona(200, 5, "NEW", Program.SizeInPX, Program.TagName, true, 0, Properties.Resources.cuadroVerde, Program.Identificador, Program.Gdispositivo, Program.Gdispositivo, Program.Gfigura); } } }
private void Panel_DoubleClick(object sender, EventArgs e) { string tag = (sender as PictureBox).Tag.ToString(); string[] namesArray = tag.Split('*'); List <string> namesList = new List <string>(namesArray.Length); namesList.AddRange(namesArray); Program.TagName = namesList[4]; Program.SizeInPX = Convert.ToInt32(namesList[3]); IdDetectorAeditar = Convert.ToInt32(namesList[1]); Program.Identificador = namesList[2]; Program.Gdispositivo = namesList[5]; Program.GtipoDispositivo = namesList[6]; Program.Gfigura = namesList[7]; NameZoneForm form = new NameZoneForm(); form.ShowDialog(); if (Program.TagName != "") { (sender as PictureBox).Tag = namesList[0] + "*" + IdDetectorAeditar + "*" + Program.Identificador + "*" + Program.SizeInPX.ToString() + "*" + Program.TagName + "*" + Program.Gdispositivo + "*" + Program.GtipoDispositivo + "*" + Program.Gfigura; if (Program.Gfigura == "Círculo") { (sender as PictureBox).Region = null; (sender as PictureBox).Size = new Size(Program.SizeInPX, Program.SizeInPX); var path = new System.Drawing.Drawing2D.GraphicsPath(); path.AddEllipse(0, 0, Program.SizeInPX, Program.SizeInPX); (sender as PictureBox).Region = new Region(path); (sender as PictureBox).Image = null; (sender as PictureBox).Image = Properties.Resources.cuadroVerde; } else { (sender as PictureBox).Region = null; (sender as PictureBox).Size = new Size(Program.SizeInPX, Program.SizeInPX); if (Program.Gfigura == "Letra P") { (sender as PictureBox).Image = null; (sender as PictureBox).Image = Properties.Resources.transLetraPverde; } else { (sender as PictureBox).Image = null; (sender as PictureBox).Image = Properties.Resources.cuadroVerde; } } } }