Gets the maximum number of allowed pixels for the image.
Syntax
Visual Basic (Declaration) | |
---|
Public ReadOnly Property PixelLimit As Integer |
C# | |
---|
public int PixelLimit {get;} |
Example
The following example sets the map image to a large size, then checks to see whether it fits within the pixel limit. If not, it sets the map to automatically resize. Then when the map is drawn, if it was resized, it resizes the image control to the dimensions of the resized map. Note that the Height and Width in ImageDescriptor are changed during the map draw when the map is resized.
C# | Copy Code |
---|
// Create a map image with large height/width
ESRI.ArcGIS.ADF.IMS.Carto.ImageDescriptor imageDescrip = mapView.ImageDescriptor;
imageDescrip.Width = 5000;
imageDescrip.Height = 5000;
// Automatically resize the image if necessary
imageDescrip.AutoResize = true;
// Check whether image will be resized - store value which we'll use later
bool imageResized = !imageDescrip.IsImageSizeValid;
CartoImage resultImage = mapView.Draw();
// If the image was resized during draw, resize the image control where
// map is displayed, and show a warning message.
if (imageResized)
{
imgMap.Height = new Unit(Convert.ToDouble(imageDescrip.Height));
imgMap.Width = new Unit(Convert.ToDouble(imageDescrip.Width));
lblOutputInfo.Text = String.Format("Warning: map image was resized to fit within "
+ "image limits of {0} pixels.", imageDescrip.PixelLimit);
}
imgMap.ImageUrl = resultImage.Url; |
Visual Basic | Copy Code |
---|
' Create a map image With large height/width
Dim imageDescrip As ESRI.ArcGIS.ADF.IMS.Carto.ImageDescriptor = mapView.ImageDescriptor
imageDescrip.Width = 5000
imageDescrip.Height = 5000
' Automatically resize the image If necessary
imageDescrip.AutoResize = True
' Check whether image will be resized - store value which we'll use later
Dim imageResized As Boolean = Not(imageDescrip.IsImageSizeValid)
Dim resultImage As CartoImage = mapView.Draw()
' If the image was resized during draw, resize the image control where
' map Is displayed, And show a warning message.
If imageResized Then
imgMap.Height = New Unit(Convert.ToDouble(imageDescrip.Height))
imgMap.Width = New Unit(Convert.ToDouble(imageDescrip.Width))
lblOutputInfo.Text = String.Format("Warning: map image was resized to fit within "
+ "image limits of {0} pixels.", imageDescrip.PixelLimit)
End If
imgMap.ImageUrl = resultImage.Url |
Remarks
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