Select to view content in your preferred language

Find absolute screen coordinates of ActiveView

2352
7
02-24-2011 03:35 AM
OlaRennemo
Occasional Contributor
Hi all, I cant find the absolute screen coordinates of IMxDocument.ActiveView upper left corner.
Using dotnet:
If I try to obtain position via component reference:  "System.Windows.Forms.Control.FromHandle(new IntPtr(ActiveView.ScreenDisplay.hWnd))" I get NULL.
I have a feeling this should be very simple, but maybe its not..
Thanks for any help!
-Ola

I forgot to mention: This is an ArcMap extension with a toolbar.
0 Kudos
7 Replies
RuchiraWelikala
Regular Contributor
0 Kudos
maxsteinbrenner
Emerging Contributor
try:

My.ArcMap.Document.ActiveView.Extent.XMin
My.ArcMap.Document.ActiveView.Extent.YMax
0 Kudos
OlaRennemo
Occasional Contributor
http://www.scs.ryerson.ca/~cps613/AssignmentReferences/DragDrop.shtml#Coordinates

Would this work?


Not quite.
Mouse positions are not availible at the time I need them.
0 Kudos
OlaRennemo
Occasional Contributor
try:

My.ArcMap.Document.ActiveView.Extent.XMin
My.ArcMap.Document.ActiveView.Extent.YMax


This gives me real world coordinates, not screen coordinates.
I can convert them the to screen coordinates, but they are always relative to the upper left corner of the map. So I need the map position as well...
0 Kudos
maxsteinbrenner
Emerging Contributor
So I need the map position as well...


i think i am not understanding what you are trying to do but; those coordinates should be the upper left corner of the map...
0 Kudos
NeilClemmons
Honored Contributor
Have you tried using the display transformation object?  It's available through IScreenDisplay.DisplayTransformation.  It may give you what you're looking for.
0 Kudos
OlaRennemo
Occasional Contributor
i think i am not understanding what you are trying to do but; those coordinates should be the upper left corner of the map...


I get map coordinates rater than screen coordinates... but I can convert them with IDisplayTransformation.  But as I said, point(0,0) is upper left corner of the map window, not the screen.

I am making a ArcMap extension/toolbar. Maybe the results is different if called from a standalone application ?

Thansk for your effort anyway!
0 Kudos