Exemplo n.º 1
0
        private void UserControl_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var position = e.GetPosition(this);

            System.Drawing.Point location = new System.Drawing.Point((int)(position.X * scaleFactor), (int)(position.Y * scaleFactor));

            plotEngagedWithMouse = figure.PlotUnderMouse(scaledSize, location);
            if (plotEngagedWithMouse != null)
            {
                if (e.ChangedButton == MouseButton.Left)
                {
                    Cursor = Cursors.SizeAll;
                    plotEngagedWithMouse.MouseDown(location, left: true);
                }
                else if (e.ChangedButton == MouseButton.Right)
                {
                    Cursor = Cursors.SizeAll;
                    plotEngagedWithMouse.MouseDown(location, right: true);
                }
                else if (e.ChangedButton == MouseButton.Middle)
                {
                    Cursor = Cursors.Cross;
                    plotEngagedWithMouse.MouseDown(location, middle: true);
                }
            }

            CaptureMouse();
        }
Exemplo n.º 2
0
 private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     plotEngagedWithMouse = figure.PlotUnderMouse(pictureBox1.Size, e.Location);
     if (plotEngagedWithMouse != null)
     {
         if (e.Button == MouseButtons.Left)
         {
             pictureBox1.Cursor = Cursors.SizeAll;
             plotEngagedWithMouse.MouseDown(e.Location, left: true);
         }
         else if (e.Button == MouseButtons.Right)
         {
             pictureBox1.Cursor = Cursors.NoMove2D;
             plotEngagedWithMouse.MouseDown(e.Location, right: true);
         }
         else if (e.Button == MouseButtons.Middle)
         {
             pictureBox1.Cursor = Cursors.Cross;
             plotEngagedWithMouse.MouseDown(e.Location, middle: true);
         }
     }
 }