Select to view content in your preferred language

C# Transform Map coordinates to Screen coordinates

1023
0
09-10-2012 01:55 PM
ZhenyuLu
Deactivated User
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
0 Kudos
0 Replies