ArcObjects Library Reference (Display)  

IDisplayTransformation.DeviceFrame Property

Visible extent in device coordinates.

[Visual Basic .NET]
Public Property DeviceFrame As tagRECT
[C#]
public tagRECT DeviceFrame {get; set;}
[C++]
HRESULT get_DeviceFrame(
  tagRECT* Bounds
);
[C++]
HRESULT put_DeviceFrame(
  tagRECT* Bounds
);
[C++]

Parameters

Bounds [out, retval]

  Bounds is a parameter of type tagRECT

Bounds [in]

  Bounds is a parameter of type tagRECT

Product Availability

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

Remarks

Each DisplayTransformation must have its Bounds, VisibleBounds, and DeviceFrame set.  The DeviceFrame is normally the full extent of the device with the origin equal to (0, 0).  Output can also be directed to some rectangle on the device by specifying the rectangle as the device frame.
For example, if a Map object is not framed, as in the case in ArcMap's data view, the Map uses the Windows API call GetClientRect to get the coordinates of the client (drawing) area of a window and stores them in this property.  This tells the Map where in the window it can draw.
A DeviceFrame can be obtained from IMxDocument::ActiveView::ScreenDisplay::DisplayTransformation::DeviceFrame. It will contain the full extent of the map window. There may be a difference between the values returned in Map view or Layout view due to the possible presence of rulers..
You may also cast a reference to the document's page layout (as found in IMxDocument::PageLayout) into an IActiveView. The IMxDocument::ActiveView::ScreenDisplay::DisplayTransformation::DeviceFrame will return the same data as above corresponding to the current device extent of the page layout.
Finally if you cast a reference to the map (e.g. from IMxDocument::FocusMap) into an IActiveView, the IMxDocument::ActiveView::ScreenDisplay::DisplayTransformation::DeviceFrame will return the current device extent of the map.  In Map view it will be the same as above, but in Layout view it will give back the size of the dataframe in which the map is drawn.
Setting the DeviceFrame will fire the ITransformEvents::DeviceFrameUpdated event.  Clients typically need to know when the device frame has changed sized so they can redraw.  For example, the ScreenDisplay object listens for this event so that it may update its caches, cause a refresh, and update the scrollbars.
If you are working within ArcMap, no display object's DeviceFrame property should be changed programmatically.

See Also

IDisplayTransformation Interface

.NET Snippets

Convert Display Pixels to Map Units |