Profile Picture

Nudge/Align

Posted By Ron Sawyer 14 Years Ago
Author
Message
Ron Sawyer
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 16, Visits: 1

I am performing a nudge or an align by iterating through the view's selected nodes and setting each shape's location.

Is there a better way to do this?

(example of nudge left)

if (nDrawingView1.Selection.NodesCount < 1)

      return;

 

NShape LclShape = nDrawingView1.Selection.Nodes[0] as NShape;

if (LclShape != null)

{

      foreach (INNode Tmp in nDrawingView1.Selection.Nodes)

      {

            LclShape = Tmp as NShape;

            if (LclShape == null)

                  continue;

 

            NPointF TargetPoint = new NPointF(LclShape.Location.X - 1, LclShape.Location.Y);

            if (TargetPoint.X < 0)

            {

                  TargetPoint = new NPointF(0, LclShape.Location.Y);

            }

 

            LclShape.Location = TargetPoint;

      }

}




Threaded View



Similar Topics


Reading This Topic