Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Wrong bounds are coming with changed Dpi settings (Read 1961 times)
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Wrong bounds are coming with changed Dpi settings
Sep 2nd, 2010 at 4:03pm
Print Post  
Hi,

In our application, we are having some ShapeNodes in the diagram. With node's TopRight point, we are opening a window on node’s MouseOver event i.e. TopRight of the Node is TopLeft point of our window.
To display window in TopLeft position we are converting Node's TopRight i.e Diagram's coordinate to Screen coordinates using below mentioned code.

Point newTopRight = diagram.DocumentPlane.PointToScreen(new Point(balloonBounds.Right, balloonBounds.Top));

We are getting correct screen point with 96Dpi value but if we change Dpi value to 120, we are getting incorrect TopLeft position of the window.

Is there any way to get correct screen point in both the values of Dpi(96 and 120).

Please suggest.

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Wrong bounds are coming with changed Dpi setti
Reply #1 - Sep 2nd, 2010 at 7:48pm
Print Post  
Hi,

PointToScreen is a method of the WPF's Visual class. Perhaps it returns a WPF point and the window positioning method you are using expects screen pixel, or the other way around.

This post shows how to get the DPI value using native WPF APIs:
http://blogs.msdn.com/b/jaimer/archive/2007/03/07/getting-system-dpi-in-wpf-app....

You can multiply a point by those dx,dy values to get the pixel coordinates

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint