void cargarBloques(string lote) { bloques = DAO.Bloque.buscarBloqueLista(lote); BotonMapa b; foreach (Entidades.Bloque bloque in bloques) { b = new BotonMapa(bloque); b.Click += new EventHandler(clickBloque); toolTip1.SetToolTip(b, " Area: " + bloque.Area + "\n Numero de Plantas: " + bloque.NumPlantas); //b.Location = calcularTamaño(b); Point p = getScaledPosition(originalImage, zoomedImage, b.Location); if (p.X < 0) { p.X = 0; } if (p.X > pictureBox1.Width - 40) { p.X = pictureBox1.Width - 40; } if (p.Y < 0) { p.Y = 0; } if (p.Y > pictureBox1.Height - 60) { p.Y = pictureBox1.Height - 60; } b.Location = p; pictureBox1.Controls.Add(b); b.BringToFront(); b.Font = new Font(b.Font, FontStyle.Underline); botones.Add(b); //agregarBloqueTabla(b, true); } }
void quitarBloqueTabla(BotonMapa b) { foreach (var button in botones.Where(bo => bo.Seccion.IdBloque == b.Bloque.IdBloque)) { button.Font = new Font(button.Font, FontStyle.Regular); } listActual = listActual.Where(bo => bo.IdBloque != b.Bloque.IdBloque).ToList(); }
void crearButtonSeccion(Entidades.Seccion s) { BotonMapa b = new BotonMapa(s); b.MouseDown += new MouseEventHandler(mouseDown); b.MouseUp += new MouseEventHandler(mouseUp); b.MouseMove += new MouseEventHandler(mouseMove); //b.BackColor = pictureBox1.BackColor;///// toolTip1.SetToolTip(b, " Area: " + s.Area + "\n Numero de Plantas: " + s.NumPlantas); this.pictureBox1.Controls.Add(b); b.BringToFront(); }
void crearButtonBloque(Entidades.Bloque bloque) { BotonMapa b = new BotonMapa(bloque); b.MouseDown += new MouseEventHandler(mouseDown); b.MouseUp += new MouseEventHandler(mouseUp); b.MouseMove += new MouseEventHandler(mouseMove); toolTip1.SetToolTip(b, " Area: " + bloque.Area + "\n Numero de Plantas: " + bloque.NumPlantas); this.pictureBox1.Controls.Add(b); b.BringToFront(); cargarCombo(); }
void generarFechaSiguiente(BotonMapa b) { try { listActual.Add(DAO.Fechas.obtenerFechaSiguiente(b.seccion)); agregarSeccionesTabla(); b.Font = new Font(b.Font, FontStyle.Underline); } catch { b.ForeColor = Color.Red; return; } }
void agregarBloqueTabla(BotonMapa b) { quitarBloqueTabla(b); foreach (var button in botones.Where(bo => bo.Seccion.IdBloque == b.Bloque.IdBloque)) { try { listActual.Add(DAO.Fechas.obtenerFechaSiguiente(button.seccion)); button.Font = new Font(button.Font, FontStyle.Underline); } catch { } } b.Font = new Font(b.Font, FontStyle.Underline); }
void clickBloque(object sender, EventArgs e) { BotonMapa b = (BotonMapa)sender; if (!b.Font.Underline) { agregarBloqueTabla(b); agregarSeccionesTabla(); } else { quitarBloqueTabla(b); b.Font = new Font(b.Font, FontStyle.Regular); agregarSeccionesTabla(); } }
void clickSeccion(object sender, EventArgs e) { BotonMapa b = (BotonMapa)sender; if (!b.Font.Underline) { try { listActual.Add(DAO.Fechas.obtenerFechaSiguiente(b.seccion)); b.Font = new Font(b.Font, FontStyle.Underline); agregarSeccionesTabla(); } catch { MessageBox.Show("Esta seccion no puede ser aplicada"); } } else { Entidades.Seccion s = listActual.Where(se => se.IdBloque == b.seccion.IdBloque && se.IdSeccion == b.seccion.IdSeccion).First(); listActual.Remove(s); b.Font = new Font(b.Font, FontStyle.Regular); agregarSeccionesTabla(); } }
void cargarSeccion(string lote) { secciones = DAO.Seccion.buscarSeccionPorLote(lote); BotonMapa b; foreach (Entidades.Seccion nombre in secciones) { b = new BotonMapa(nombre); b.Name = nombre.IdBloque + "." + nombre.IdSeccion; b.Click += new EventHandler(clickSeccion); toolTip1.SetToolTip(b, " Area: " + nombre.Area + "\n Numero de Plantas: " + nombre.NumPlantas); //b.Location = calcularTamaño(b); Point p = getScaledPosition(originalImage, zoomedImage, b.Location); if (p.X < 0) { p.X = 0; } if (p.X > pictureBox1.Width - 40) { p.X = pictureBox1.Width - 40; } if (p.Y < 0) { p.Y = 0; } if (p.Y > pictureBox1.Height - 60) { p.Y = pictureBox1.Height - 60; } b.Location = p; pictureBox1.Controls.Add(b); b.BringToFront(); generarFechaSiguiente(b); botones.Add(b); } }