Profile Picture

Control.MousePosition (Point) To Document Coords (NPointF) ?

Posted By michal bandrowski 15 Years Ago

Control.MousePosition (Point) To Document Coords (NPointF) ?

Author
Message
Ivo Milanov
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 35, Visits: 15
Hi,

Client coordinates for the drawing view can be converted to scene coordinates (document) with the help of the drawingView.SceneToDevice transformation. For example: if you have a point in client coordinates (e.g. relative to the drawing view control) you can convert to document coordinates like this:

NPointF pt = new NPointF(clientX, clientY);
pt = nDrawingView1.SceneToDevice.InvertPoint(pt);

If the mouse coordinates are in screen coordinates you have to first convert them to control client coordinates like this:

Point pt = new Point(screenX, screenY);
pt = nDrawingView1.PointToClient(pt);

Hope this helps...

Best regards,
Ivo



michal bandrowski
Posted 15 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 10, Visits: 1
Hi,

How can I translate mouse position Point(int, int) to document coords NPointF(float, float)?

Thanks in advance,
Michal



Similar Topics


Reading This Topic