Profile Picture

Scrool to a Specific Shape

Posted By Ashton Hobbs 13 Years Ago
Author
Message
Ashton Hobbs
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 0, Visits: 1
Is it possible to scroll to a specific shape in the diagram given the shapes UniqueID (or some other identifier for the shape).

I have an external list of the shapes in the diagram and when a user clicks on a an item in my list I want to scroll the diagram to ensure that the specific shape is visible (and selected).

Thanks

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 8:46 AM
Posts: 3,054, Visits: 4,012

Hi,

Here’s a sample code how to select a shape by its name (you can use also its ID or UniqueID) and center the viewport on it:

 

// Get the shape and select it

NShape shape = (NShape)document.ActiveLayer.GetChildByName("MyShape");

view.Selection.SingleSelect(shape);

 

// Center the viewport at the shape's center

NPointF origin = view.ViewportOrigin;

NPointF offset = shape.Center - view.Viewport.Center;

view.ViewportOrigin = new NPointF(origin.X + offset.X, origin.Y + offset.Y);



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic