MapWinGIS:AxMap PixelToProj
From MapWindow GIS
PixelToProj
Converts pixel coordinates to projected map coordinates.
VB.NET Usage
Sub PixelToProj(pixelX As Double, pixelY As Double, ByRef projX As Double, ByRef projY As Double)
Parameters
|
pixelX | The x pixel coordinate to be converted into the projected x map coordinate. |
| pixelY | The y pixel coordinate to be converted into the projected y map coordinate. |
| projX | The projected x map coordinate is returned through this reference parameter. |
| projY | The projected y map coordinate is returned through this reference parameter. |
Sample Code
Private Sub Map1_MouseUpEvent(ByVal sender As System.Object, ByVal e As AxMapWinGIS._DMapEvents_MouseUpEvent) Handles Map1.MouseUpEvent
'This will draw a point where you click on the map if you have a
'spatially referenced shapefile or grid displayed on the map
Dim x As Double, y As Double
'Convert pixel coordinates of mouse up event e.x and e.y to projected coordinates returned by x and y
Map1.PixelToProj(e.x, e.y, x, y)
'Create a new drawing layer in map1
Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
'Draw a red point where the mouse up event occured in map1
Map1.DrawPoint(x, y, 5, System.Convert.ToUInt32(RGB(255, 0, 0)))
End Sub
'VB 6 Usage
'Sub PixelToProj(pixelX As Double, pixelY As Double, ByRef projX As Double, ByRef projY As Double)
Parameters
|
pixelX | The x pixel coordinate. |
| pixelY | The y pixel coordinate. |
| projX | The projected x coordinate is returned through this reference parameter. |
| projY | The projected y coordinate is returned through this reference parameter. |
Sample Code
Private Sub Map1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)
'This will draw a point where you click on the map if you have a
'spatially referenced shapefile or grid displayed on the map
Dim px As Double, py As Double
'Convert pixel coordinates of mouse down event e.x and e.y to projected coordinates returned by x and y
Map1.PixelToProj X, Y, px, py
'Create a new drawing layer in map1
Map1.NewDrawing (dlSpatiallyReferencedList)
'Draw a red point where the mouse down event occured in map1
Map1.DrawPoint px, py, 5, RGB(255, 0, 0)
End Sub
















