This document is archived and information here might be outdated.  Recommended version.


IMapServerLayout.FromPagePoints Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IM > IMapServerLayout Interface > IMapServerLayout.FromPagePoints Method
ArcGIS Developer Help

IMapServerLayout.FromPagePoints Method

Converts a page coordinate to a screen location.

[Visual Basic .NET]
Public Sub FromPagePoints ( _
    ByVal pageExtent As IEnvelope, _
    ByVal pageDisplay As IImageDisplay, _
    ByVal pagePoints As IPointCollection, _
    ByRef screenXValues As ILongArray, _
    ByRef screenYValues As ILongArray _
)
[C#]
public void FromPagePoints (
    IEnvelope pageExtent,
    IImageDisplay pageDisplay,
    IPointCollection pagePoints,
    ref ILongArray screenXValues,
    ref ILongArray screenYValues
);
[C++]
HRESULT FromPagePoints(
  IEnvelope* pageExtent,
  IImageDisplay* pageDisplay,
  IPointCollection* pagePoints,
  ILongArray** screenXValues,
  ILongArray** screenYValues
);
[C++]
Parameters
pageExtent [in]

pageExtent is a parameter of type IEnvelope* pageDisplay [in]
pageDisplay is a parameter of type IImageDisplay* pagePoints [in]
pagePoints is a parameter of type IPointCollection* screenXValues [in, out]
screenXValues is a parameter of type ILongArray** screenYValues [in, out]
screenYValues is a parameter of type ILongArray**

Product Availability

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

Remarks

Use FromPagePoints to convert page unit coordinates on the layout to pixel coordinates on the screen.

[C#]

The following sample code shows how to convert the upper left corner of your page (page coordinates) to a screen location. It assumes that you already have a valid MapServerLayout and PageDescription object, and that you are not working with a server context. However, if you are developing an ArcGIS for Server application using a server context, you should not use New to create local ArcObjects, but you should always create objects within the server by calling CreateObject on IServerContext.

IMapServerLayout mapServerLayout;
IPageDescription pageDesc;

// Create image display
IImageDisplay imageDisp = new ImageDisplayClass();
imageDisp.Height = 550;
imageDisp.Width = 425;

// Get page coordinates (upper left corner)
IEnvelope pageExtent = pageDesc.Extent;
IPoint point = new PointClass();
point.X = pageExtent.XMin;
point.Y = pageExtent.YMax;

// Add point to point collection
IPointCollection pointCollection = new MultipointClass();
System.Object pMissing = System.Reflection.Missing.Value;
pointCollection.AddPoint(point, ref pMissing, ref pMissing);

// Convert page coordinates to screen location
ILongArray screenXValues = new LongArrayClass ();
ILongArray screenYValues = new LongArrayClass ();
mapServerLayout.FromPagePoints(pageExtent, imageDisp, pointCollection, ref screenXValues, ref screenYValues);

// Please note:
// 1. Origin of screen coordinate system is upper left corner
// 2. If aspect ratio of requested layout image is different from aspect ratio of
// input map layout, requested layout image will be adjusted to fit
// input map layout -> following screen locations are not necessarily 0:
MessageBox.Show(screenXValues.get_Element(0).ToString());
MessageBox.Show(screenYValues.get_Element(0).ToString());

See Also

IMapServerLayout Interface