Profile Picture

Edit NShape.Geometry Programatically

Posted By RLDP 2000 Last Year
Author
Message
RLDP 2000
Question Posted Last Year
View Quick Profile
Junior Member

Junior Member (23 reputation)Junior Member (23 reputation)Junior Member (23 reputation)Junior Member (23 reputation)Junior Member (23 reputation)Junior Member (23 reputation)Junior Member (23 reputation)Junior Member (23 reputation)Junior Member (23 reputation)

Group: Forum Members
Last Active: 6 days ago @ 5:46 PM
Posts: 10, Visits: 360
Hi,

May I ask how can I replicate editing Geometry MoveTo values in code?
I would like to update NShape.Geometry without re-drawing the whole Geometry sequence.


Thank you for your support!

Nevron Support
This post has been flagged as an answer
Posted Last Year
View Quick Profile
Supreme Being

Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)

Group: Forum Members
Last Active: 7 hours ago
Posts: 3,055, Visits: 4,052
Hi,

The following piece of code creates a shape with a triangle geometry:

const bool CloseFigure = true;

// Create a shape with a triangle geometry
NShape shape = new NShape();
shape.Geometry.AddRelative(new NMoveTo(0.5, 0, CloseFigure));
shape.Geometry.AddRelative(new NLineTo(1, 1));
shape.Geometry.AddRelative(new NLineTo(0, 1));
shape.Geometry.AddRelative(new NLineTo(0.5, 0));
shape.SetBounds(200, 200, 100, 100);

// Add the shape to the page
drawingView.ActivePage.Items.Add(shape);

The code above will create the following shape:


You can then modify the shape geometry, for example you can change the third geometry command like this:
((NLineTo)shape.Geometry[2]).X = 0.5;

You will then get the following shape:


For more information on shape geometry, please open the following documentation topic:


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic