luzhenyu

C# Transform Map coordinates to Screen coordinates

Discussion created by luzhenyu on Sep 10, 2012
Hi,

I have a question regarding employing ArcObjects to transform the map coordinates to screen coordinates. Generally, I would like to know the location of a map point in the ActiveView (see below):
[ATTACH=CONFIG]17587[/ATTACH]
What I need is the arcview coordinates in red rectangle. I am using the function named DisplayTransformation. Underneath is the part of code to convert the coordinates.

IPageLayout pPageLayout = __mDoc.PageLayout;
IGraphicsContainer pGraphicsContainter = pPageLayout as IGraphicsContainer;
IActiveView pActiveView = pPageLayout as IActiveView;
IScreenDisplay pDisplay = pActiveView.ScreenDisplay;
IDisplayTransformation pTransform = pDisplay.DisplayTransformation;
IPoint pPoint = pFeature.Shape as IPoint;
System.Int32 sx= 0;
System.Int32 sy= 0;
pTransform.FromMapPoint(pPoint, out mx, out my);

However, every time I convert a point with coordinates of 964607.6264 and 1085671.573 to screen coordinates, it ended up with a value of 77327282 and -87031210 which is obviously not what I want. So my question is, am I using a wrong function? If yes, what function should I use exactly. Or the result is correct, and I just don't interpret it correctly.

Please let me know if you know the answer.
Thank you so much,

Zhenyu

Attachments

Outcomes