Leadtools.Windows.Controls Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.03.25
ScaleFactor Property
See Also  Example
Leadtools.Windows.Controls Namespace > BitmapSourceViewerElement Class : ScaleFactor Property





This member is available in the WPF Express Edition. See the LEADTOOLS products page for full details on more WPF features available with LEADTOOLS toolkits.

The zoom factor used to display the image. This is a dependency property.

Syntax

Visual Basic (Declaration) 
Public Property ScaleFactor As Double
Visual Basic (Usage)Copy Code
Dim instance As BitmapSourceViewerElement
Dim value As Double
 
instance.ScaleFactor = value
 
value = instance.ScaleFactor
C# 
public double ScaleFactor {get; set;}
Managed Extensions for C++ 
public: __property double get_ScaleFactor();
public: __property void set_ScaleFactor( 
   double value
);
C++/CLI 
public:
property double ScaleFactor {
   double get();
   void set (double value);
}
XAML Attributes Usage 

<object ScaleFactor=double .../>

Dependency Property Information 

Identifier field

ScaleFactorProperty

Metadata properties set to true

AffectsMeasure, Inherits

Return Value

The zoom factor used to display the image.

Example

This example zooms out on the image displayed in the viewer

Visual BasicCopy Code
Public Sub BitmapSourceViewerElement_ScaleFactor(ByVal viewer As BitmapSourceViewerElement)
   viewer.ScaleFactor = viewer.ScaleFactor * 0.9F
   Dim s As String = String.Format("HorizontalScaleFactor {0}, VerticalScaleFactor {1}", viewer.HorizontalScaleFactor, viewer.VerticalScaleFactor)
   MessageBox.Show(s)
End Sub
C#Copy Code
public void BitmapSourceViewerElement_ScaleFactor(BitmapSourceViewerElement viewer) 

   viewer.ScaleFactor = viewer.ScaleFactor * 0.9f; 
   string s = string.Format("HorizontalScaleFactor {0}, VerticalScaleFactor {1}", viewer.HorizontalScaleFactor, viewer.VerticalScaleFactor); 
   MessageBox.Show(s); 
}
XAMLCopy Code
<Window x:Class="WPFSamples.BitmapSourceViewerElement" Height="600" Width="800" 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"> 
  <DockPanel> 
    <Leadtools_Windows_Controls:BitmapSourceViewerElement Name="theImage" Source="file:///C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\slave.jpg" DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Bottom" ScaleFactor=".5"></Leadtools_Windows_Controls:BitmapSourceViewerElement> 
  </DockPanel> 
</Window>

Remarks

You can get and set this property when the SizeMode property is PaintSizeMode.Normal.
This property is read only when the SizeMode property is set to any other value. When SizeMode is set to PaintSizeMode.Stretch, the zoom factor is the smallest of the Width or Height zoom factors (the aspect ratio is not preserved).

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also