ESRI.ArcGIS.ADF.IMS
DataFrame Class
Members  Example  See Also  Send Feedback
ESRI.ArcGIS.ADF.IMS.Carto Namespace : DataFrame Class




Represents a data frame in an ArcMap Server service.

Object Model

DataFrame Class

Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class DataFrame 
Visual Basic (Usage)Copy Code
Dim instance As DataFrame
C# 
[SerializableAttribute()]
public class DataFrame 

Example

The following example displays some properties of a data frame, and then changes the spatial reference and extent of the data frame. It generates a layout file that will display the modified data frame.
C#Copy Code
LayoutView layoutView = mapService.CreateLayoutView();
layoutView.ImageDescriptor.ImageFormat = ESRI.ArcGIS.ADF.Web.ImageFormat.PDF;
 
DataFrame worldFrame = layoutView.DataFrames[1];
 
// Print some information about the data frame
lblDataFrameInfo.Text =
    "Data frame information:<br>" +
    "Data frame name: " + worldFrame.Name + "<br>" +
    "First layer name: " + worldFrame.Layers[0].Name + "<br>" +
    "Background color: " + worldFrame.BackColor.Name + "<br>" +
    "Default extent: " + worldFrame.DefaultExtent.ToString() + "<br>" +
    "Map units: " + worldFrame.MapUnits.ToString() + "<br>";
 
// Use the Robinson projection (ID of 54030) for one data frame
SpatialReference spatialRef = new SpatialReference(54030);
worldFrame.SpatialReference = spatialRef;
 
// Set the extent of the data frame with a geographic coordinates
Envelope worldEnv = new Envelope(-130, 25, -100, 50);
worldEnv.SpatialReference = new SpatialReference(4326);
worldFrame.Extent = worldEnv;
 
// Turn off a layer in a data frame
worldFrame.Layers[0].Visible = false;
 
// Generate a layout file
ESRI.ArcGIS.ADF.Web.CartoImage image = layoutView.Draw();
lblLayoutView.Text = "Layout is available at: " + image.Url;
Visual BasicCopy Code
Dim layoutView As LayoutView = mapService.CreateLayoutView()
layoutView.ImageDescriptor.ImageFormat = ESRI.ArcGIS.ADF.Web.ImageFormat.PDF
 
DataFrame worldFrame = layoutView.DataFrames(0)
 
' Print some information about the data frame
lblDataFrameInfo.Text = _
    "Data frame information:<br>" + _
    "Data frame name: " + worldFrame.Name + "<br>" + _
    "First layer name: " + worldFrame.Layers(0).Name + "<br>" + _
    "Background color: " + worldFrame.BackColor.Name + "<br>" + _
    "Default extent: " + worldFrame.DefaultExtent.ToString() + "<br>" + _
    "Map units: " + worldFrame.MapUnits.ToString() + "<br>"
 
' Use the Robinson projection (ID of 54030) For one Data frame
SpatialReference spatialRef = New SpatialReference(54030)
worldFrame.SpatialReference = spatialRef
 
' Set the extent of the Data frame With a geographic coordinates
Envelope worldEnv = New Envelope(-130, 25, -100, 50)
worldEnv.SpatialReference = New SpatialReference(4326)
worldFrame.Extent = worldEnv
 
' Turn off a layer In a Data frame
worldFrame.Layers(0).Visible = False
 
' Generate a layout file
ESRI.ArcGIS.ADF.Web.CartoImage image = layoutView.Draw()
lblLayoutView.Text = "Layout is available at: " + image.Url

Remarks

ArcMap documents consist of data frames. Each data frame can have its own coordinate system and a separate sets of map layers. A DataFrame object represents one of these frames in the ArcMap Server service.

Each data frame is represented within the layout of the ArcMap service. The layout, a display and print-oriented view of the ArcMap document and service, is represented by a LayoutView object. The LayoutView's DataFrames property allows you to access the data frames in the layout. The data frame is normally placed somewhere within the printable page of the layout.

Most of the properties of the DataFrame are read-only. Properties that can be set are Extent and SpatialReference. These allow you to modify the map extent displayed and the coordinate system of the data frame.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2011 All Rights Reserved.