ArcGIS Explorer Component Help |
ImageOverlay..::.LockAspectRatio Property |
ImageOverlay Class Example See Also |
Gets or sets a value indicating whether the aspect ratio of the image overlay should be maintained when the image overlay is resized.
Namespace:
ESRI.ArcGISExplorer.MappingAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public bool LockAspectRatio { get; set; } |
Visual Basic (Declaration) |
---|
Public Property LockAspectRatio As Boolean |
Field Value
trueTruetruetrue (True in Visual Basic) if the aspect ratio of the image overlay should be maintained when resized; otherwise, falseFalsefalsefalse (False in Visual Basic).Remarks
The default value for LockAspectRatio is true.
If LockAspectRatio is true, the original proportions of the image are maintained when the size changes. For example, if an image is 200 x 100 you can set the ScalingSize to 400,400, but since the aspect ratio is locked the width:height ratio is maintained and the resultant image has the dimensions 400 x 200. If LockAspectRatio is false, the proportions of the image are not maintained and the image is stretched to the size that you specify (which will usually distort the image unless the aspect ratio of the original image matches the aspect ratio of the specified scaling size).
Examples
CopyC#
Map myMap = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map; //Create a new image overlay from an existing PNG file ImageOverlay imgOverlay = new ImageOverlay("Logo", "C:\\Images\\Logo.png"); //Add the new image overlay to the Map myMap.ChildItems.Add(imgOverlay); //LockAspectRatio is true by default. imgOverlay.LockAspectRatio = false; //Note that since LockAspectRatio is false, the original proportions of the image are not maintained when using ScalingSize. imgOverlay.ScalingSize = new Size(90, 120); //Set a specific color in the image overlay as transparent. imgOverlay.MakeTransparent(Color.Black);
CopyVB.NET
Dim myMap As Map = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map 'Create a new image overlay from an existing PNG file Dim imgOverlay As ImageOverlay = New ImageOverlay("Logo", "C:\Images\Logo.png") 'Add the new image overlay to the Map myMap.ChildItems.Add(imgOverlay) 'LockAspectRatio is true by default. imgOverlay.LockAspectRatio = False 'Note that since LockAspectRatio is false, the original proportions of the image are not maintained when using ScalingSize. imgOverlay.ScalingSize = New Size(90, 120) 'Set a specific color in the image overlay as transparent. imgOverlay.MakeTransparent(Color.Black)