Nudge/Align


Author
Message
Ron Sawyer
Ron Sawyer
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
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;

      }

}


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search