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


IMapContext.InitFromDisplay Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Display > ESRI.ArcGIS.Display > Interfaces > IM > IMapContext Interface > IMapContext.InitFromDisplay Method
ArcGIS Developer Help

IMapContext.InitFromDisplay Method

Initializes the map context using a display transformation.

[Visual Basic .NET]
Public Sub InitFromDisplay ( _
    ByVal displayTransform As IDisplayTransformation _
)
[C#]
public void InitFromDisplay (
    IDisplayTransformation displayTransform
);
[C++]
HRESULT InitFromDisplay(
  IDisplayTransformation* displayTransform
);
[C++]
Parameters
displayTransform [in]

displayTransform is a parameter of type IDisplayTransformation*

Product Availability

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

Remarks

Use this method when you create a reference to a new MapContext object to initialize the mapcontext using a DisplayTransformation that exists. If a reference to a DisplayTransformation does not exist, then use IMapContext::Init method to initialize the map context. It is important to initialize the map context as this will help in getting correct context for displaying and drawing geometric effects and marker placements.

Use the following code snippet to initialize a MapContext using display settings from a map document

Dim pMxDoc As IMxDocument
Dim pMap As IMap
Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap

'set the MapContext object from current display settings
Dim pMapContext As IMapContext
Dim pMxApp As IMxApplication
Set pMxApp = Application 'QI
Set pMapContext = New MapContext
pMapContext.InitFromDisplay pMxApp.Display.DisplayTransformation

See Also

IMapContext Interface