ESRI.ArcGIS.ADF.IMS
ToMapPoint(Point,Envelope,Int32,Int32) Method
See Also  Example
ESRI.ArcGIS.ADF.IMS.Geometry Namespace > Point Class > ToMapPoint Method : ToMapPoint(Point,Envelope,Int32,Int32) Method




pixelPoint
extent
imageWidth
imageHeight
Converts a System.Drawing.Point in screen coordinates to a Point in Map coordinates.

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function ToMapPoint( _
   ByVal pixelPoint As Point, _
   ByVal extent As Envelope, _
   ByVal imageWidth As Integer, _
   ByVal imageHeight As Integer _
) As Point
Visual Basic (Usage)Copy Code
Dim pixelPoint As Point
Dim extent As Envelope
Dim imageWidth As Integer
Dim imageHeight As Integer
Dim value As Point
 
value = Point.ToMapPoint(pixelPoint, extent, imageWidth, imageHeight)
C# 
public static Point ToMapPoint( 
   Point pixelPoint,
   Envelope extent,
   int imageWidth,
   int imageHeight
)

Parameters

pixelPoint
extent
imageWidth
imageHeight

Return Value

Point in Map coordinates.

Example

This example converts a screen point to a point based on map coordinates, using the current MapView's properties.
C#Copy Code
System.Drawing.Point screenPt = new System.Drawing.Point(35, 120); 

ESRI.ArcGIS.ADF.IMS.Geometry.Point mapPoint =  

    ESRI.ArcGIS.ADF.IMS.Geometry.Point.ToMapPoint(screenPt,  

    mapView.Extent, mapView.ImageDescriptor.Width,  

    mapView.ImageDescriptor.Height); 

Label1.Text = String.Format("Map point is: {0}, {1}",  

    mapPoint.X, mapPoint.Y); 

    
Visual BasicCopy Code
Dim screenPt As New System.Drawing.Point(35, 120)

Dim mapPoint As ESRI.ArcGIS.ADF.IMS.Geometry.Point = _

    ESRI.ArcGIS.ADF.IMS.Geometry.Point.ToMapPoint(screenPt, _

    mapView.Extent, mapView.ImageDescriptor.Width, _

    mapView.ImageDescriptor.Height)

Label1.Text = String.Format("Map point is: {0}, {1}", _

    mapPoint.X, mapPoint.Y)

Remarks

This method converts a location in screen pixel coordinates to map coordinates. Note that the input point is a System.Drawing.Point object, not a Point in ESRI.ArcGIS.ADF.IMS.Geometry.

This is a static (Shared) method, so that it is used without creating an instance of Point.

See Also

© 2010 All Rights Reserved.