0

In the drawing DrawInteractive mode, I understand there is a snap option design1.GridSnapEnabled = true; for the MyDesign:Design design1 to ensure the line can be drawn as a straight line. However for the case when my start point is not on the grid snap (Let's say my intend is to have it not stay on the grid), I want to force the cursor movement horizontally by pressing the Shift Key or anything, how the code can be implemented?

enter image description here

N.TW12
  • 241
  • 2
  • 11

1 Answers1

1

You can modify the mouseLocation variable as follows:

private void ForceHorizontal()
        {
            if(points==null || points.Count==0)
                return;
            Point3D p = WorldToScreen(points[0]);

            mouseLocation = new System.Drawing.Point(mouseLocation.X, (int)ActiveViewport.Size.Height - (int)p.Y);
        }

I would insert this method at the beginning of OnMouseMove() and at the beginning of the OnMouseDown().

aSpagno
  • 141
  • 5