Nevron Forum
Back
Login
Register
Login
Register
Home
»
Nevron Vision for NET
»
Nevron Diagram for .NET
»
Transform Shape Bounds to screen bounds
Transform Shape Bounds to screen bounds
Post Reply
Transform Shape Bounds to screen bounds
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
Goto Topics Forum
Author
Message
Kevin Harrison 1
Kevin Harrison 1
posted 9 Years Ago
ANSWER
Topic Details
Group: Forum Members
Posts: 176,
Visits: 1.9K
Hi
We want to simulate clicking on a shape in a diagram for testing purposes.
How do I transform the shape bounds within the view to screen coordinates?
Thanks
Kevin
Reply
Like
0
Replies
Kevin Harrison 1
Kevin Harrison 1
posted 9 Years Ago
ANSWER
Post Details
Group: Forum Members
Posts: 176,
Visits: 1.9K
We've tried using shape.WorldTransform.TransformBounds(shape.Bounds).
The relative positions of the shapes are correct, but they are not the coordinates of the pixels on the screen. What offset do we need to apply?
Thanks
Kevin
Reply
Like
0
Nevron Support
Nevron Support
posted 9 Years Ago
ANSWER
Post Details
Group: Administrators
Posts: 3.1K,
Visits: 4.2K
Hi,
The bounds of a shape are in scene coordinates, so in order to get its bounds in screen coordinates you should first convert the scene coordinates to device coordinates using the drawing view's
SceneToDevice
transform and then convert the result to screen coordinates using the standard WinForms
Control.PointToScreen
method. Here's an example:
NRectangleF bounds = view.SceneToDevice.TransformBounds(shape.Bounds);
Point topLeft = view.PointToScreen(bounds.Location.Round().ToPoint());
Point bottomRight = view.PointToScreen(bounds.RightBottom.Round().ToPoint());
For more information about the coordinate systems used in Nevron Diagram for .NET, check out the
Coordinate Systems
documentation topic.
Best Regards,
Nevron Support Team
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Threaded View
Threaded View
Transform Shape Bounds to screen bounds
Kevin Harrison 1
-
9 Years Ago
We've tried using shape.WorldTransform.TransformBounds(shape.Bounds)....
Kevin Harrison 1
-
9 Years Ago
Hi, The bounds of a shape are in scene coordinates, so in order to...
Nevron Support
-
9 Years Ago
Thanks guys.
Kevin Harrison 1
-
9 Years Ago
Post Reply
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search