ArcObjects Library Reference (Geometry)  

IEnvelope.QueryCoords Method

Returns the coordinates of lower, left and upper, right corners.

[Visual Basic .NET]
Public Sub QueryCoords ( _
    ByRef XMin As Double, _
    ByRef YMin As Double, _
    ByRef XMax As Double, _
    ByRef YMax As Double _
)
[C#]
public void QueryCoords (
    ref double XMin,
    ref double YMin,
    ref double XMax,
    ref double YMax
);
[C++]
HRESULT QueryCoords(
  double* XMin,
  double* YMin,
  double* XMax,
  double* YMax
);
[C++]

Parameters

XMin [out]   XMin is a parameter of type double YMin [out]   YMin is a parameter of type double XMax [out]   XMax is a parameter of type double YMax [out]   YMax is a parameter of type double

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

Returns the XMin, YMin, XMax, and YMax values for the Envelope.  These values can also be used to recreate the Envelope using PutCoords.

[C#]

The following C# Code shows how to query for the XMin, YMin, XMax and YMax coordinates.

private void QueryCoordinates()
{
    IEnvelope envelope = new EnvelopeClass();
    envelope.PutCoords(100, 100, 200, 200);
    double minX;
    double minY;
    double maxX;
    double maxY;
    envelope.QueryCoords(out minX, out minY, out maxX, out maxY);
    String report = " \n" +
                     "LowerLeft  X =  " + minX + "\n" +
                     "LowerLeft  Y =  " + minY + "\n\n" +
                     "LowerRight X =  " + maxX + "\n" +
                     "LowerRight Y =  " + minY + "\n\n" +
                     "UpperLeft  X =  " + minX + "\n" +
                     "UpperLeft  Y =  " + maxY + "\n\n" +
                     "UpperRight X =  " + maxY + "\n" +
                     "UpperRight Y =  " + maxY;
    System.Windows.Forms.MessageBox.Show(report);

}       

 

[Visual Basic .NET]

    ' Given the Envelope m_pEnveLope the QueryCoords method returns the values
    ' of the min and max coordinates.

    Private Sub QueryCoords(ByRef m_pEnvelope As IEnvelope)
        Dim dXmin As Double, dYmin As Double, dXmax As Double, dYmax As Double
        m_pEnvelope.QueryCoords(dXmin, dYmin, dXmax, dYmax)
    End Sub

See Also

IEnvelope Interface | IEnvelope.PutCoords Method

.NET Samples

Custom scene navigation commands (Code Files: Fly)