LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly)
LEAD Technologies, Inc

ScaleFactor Property (ImageViewer)

Example 





Gets or sets the zoom factor used to display the image. This is a dependency property. .NET support Silverlight support
Syntax
public double ScaleFactor {get; set;}
'Declaration
 
Public Property ScaleFactor As Double
'Usage
 
Dim instance As ImageViewer
Dim value As Double
 
instance.ScaleFactor = value
 
value = instance.ScaleFactor
public double ScaleFactor {get; set;}
 get_ScaleFactor();
set_ScaleFactor(value);
public:
property double ScaleFactor {
   double get();
   void set (    double value);
}

Property Value

The zoom factor used to display the image. A value of 1.0 means 100 percent, a value of 1.5 means 150 percent, a value of 2.0 = 200 percent and so on. Default value is 1.0
Remarks

When the value of SizeMode is set to SizeMode.Normal, you can use the ScaleFactor property to zoom in and out of the image. Values greater than 1.0 will zoom the image in, values less than 1.0 will zoom the image out.

When the value of SizeMode is set to anything other than SizeMode.Normal, the ScaleFactor will be set back to the default value of 1.0. To get the current horizontal and vertical scale factors used to achieve current size mode (for example, fit the image into the control), use the CurrentXScaleFactor and CurrentYScaleFactor properties. Changing the scale factor when the SizeMode is set to anything other than SizeMode.Normal will cause SizeMode to be set back to SizeMode.Normal.

Example
Copy CodeCopy Code  
Public Sub ImageViewer_ScaleFactor(ByVal viewer As ImageViewer)
    viewer.ScaleFactor = viewer.ScaleFactor * 0.9F
    Dim s As String = String.Format("HorizontalScaleFactor {0}, VerticalScaleFactor {1}", viewer.CurrentXScaleFactor, viewer.CurrentYScaleFactor)
    MessageBox.Show(s)
End Sub
public void ImageViewer_ScaleFactor(ImageViewer viewer)
{
   viewer.ScaleFactor = viewer.ScaleFactor * 0.9f;
   string s = string.Format("HorizontalScaleFactor {0}, VerticalScaleFactor {1}", viewer.CurrentXScaleFactor, viewer.CurrentYScaleFactor);
   MessageBox.Show(s);
}
public void ImageViewer_ScaleFactor(ImageViewer viewer)
{
   viewer.ScaleFactor = viewer.ScaleFactor * 0.9f;
   string s = string.Format("HorizontalScaleFactor {0}, VerticalScaleFactor {1}", viewer.CurrentXScaleFactor, viewer.CurrentYScaleFactor);
   MessageBox.Show(s);
}
Public Sub ImageViewer_ScaleFactor(ByVal viewer As ImageViewer)
   viewer.ScaleFactor = viewer.ScaleFactor * 0.9F
   Dim s As String = String.Format("HorizontalScaleFactor {0}, VerticalScaleFactor {1}", viewer.CurrentXScaleFactor, viewer.CurrentYScaleFactor)
   MessageBox.Show(s)
End Sub
<Window x:Class="WPFSamples.ImageViewer"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"
  Height="600" Width="800">
  <DockPanel>
    <Leadtools_Windows_Controls:ImageViewer
      Name="theViewer"
      Source="file:///c:\users\Public\Documents\LEADTOOLS Images\cannon.jpg"
      DockPanel.Dock= "Bottom"
      HorizontalAlignment="Center" VerticalAlignment="Center"
      ScaleFactor=".9"/>
  </DockPanel>
  <Window.Title>
    InteractiveZoomTo Sample : "ScaleFactor =0.9"
  </Window.Title>

</Window>
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ImageViewer Class
ImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.