Exemple #1
0
 void mouseDownBloque(object sender, MouseEventArgs e)
 {
     activeBloque = sender as BotonBloque;
     activeBloque.BringToFront();
     previousLocation = e.Location;
     Cursor           = Cursors.Hand;
 }
Exemple #2
0
 void mouseUpBloque(object sender, MouseEventArgs e)
 {
     activeBloque = sender as BotonBloque;
     if (activeBloque.Bloque != null || !checkEditar.Checked)
     {
         //activeBloque.Bloque.PosX = activeBloque.Location.X / zoom;
         //activeBloque.Bloque.PosY = activeBloque.Location.Y / zoom;
         Point punto = getOriginalPosition(originalImage, zoomedImage, activeBloque.Location);
         activeBloque.Bloque.PosX = punto.X;
         activeBloque.Bloque.PosY = punto.Y;
         DAO.Bloque.cambiarLocation(activeBloque.Bloque);
         activeBloque.BringToFront();
         activeBloque = null;
         Cursor       = Cursors.Default;
     }
 }
Exemple #3
0
        void cargarBloques(int zoom)
        {
            if (comboLotes.SelectedIndex == -1)
            {
                return;
            }
            pictureBox1.Controls.Clear();
            listaBloques = DAO.Bloque.buscarBloqueLista(lote.IdLote);
            foreach (Entidades.Bloque bloque in listaBloques)
            {
                BotonBloque b = new BotonBloque(this, bloque);
                b.MouseDown += new MouseEventHandler(bloqueClick);
                b.MouseDown += new MouseEventHandler(mouseDownBloque);
                b.MouseUp   += new MouseEventHandler(mouseUpBloque);
                b.MouseMove += new MouseEventHandler(mouseMoveBloque);

                //Point p = new Point(b.Location.X * zoom, b.Location.Y * zoom);
                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 = menuBloque;
                pictureBox1.Controls.Add(b);
            }
        }
Exemple #4
0
        void bloqueClick(object sender, MouseEventArgs e)
        {
            BotonBloque b = (BotonBloque)sender;

            bloque = b.Bloque;
        }