void mouseDownSeccion(object sender, MouseEventArgs e) { activeSeccion = sender as BotonSeccion; activeSeccion.BringToFront(); previousLocation = e.Location; Cursor = Cursors.Hand; }
void mouseUpSeccion(object sender, MouseEventArgs e) { activeSeccion = sender as BotonSeccion; if (activeSeccion.Seccion != null || !checkEditar.Checked) //activeSeccion.Seccion.PosX = activeSeccion.Location.X/zoom; //activeSeccion.Seccion.PosY = activeSeccion.Location.Y/zoom; { Point punto = getOriginalPosition(originalImage, zoomedImage, activeSeccion.Location); activeSeccion.Seccion.PosX = punto.X; activeSeccion.Seccion.PosY = punto.Y; DAO.Seccion.cambiarLocation(activeSeccion.Seccion); activeSeccion.BringToFront(); activeSeccion = null; Cursor = Cursors.Default; } }
void cargarSecciones(int zoom) { if (comboLotes.SelectedIndex == -1) { return; } listaSecciones = DAO.Seccion.buscarSeccionLista(lote.IdLote); foreach (Entidades.Seccion s in listaSecciones) { BotonSeccion b = new BotonSeccion(this, s); b.MouseDown += new MouseEventHandler(seccionClick); b.MouseDown += new MouseEventHandler(mouseDownSeccion); b.MouseUp += new MouseEventHandler(mouseUpSeccion); b.MouseMove += new MouseEventHandler(mouseMoveSeccion); 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; b.ContextMenuStrip = menuSeccion; pictureBox1.Controls.Add(b); } }
void seccionClick(object sender, MouseEventArgs e) { BotonSeccion b = (BotonSeccion)sender; seccion = b.Seccion; }