Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.5.10
|
Leadtools.Windows.Controls Namespace > ImageBox Class : ScaleFactor Property |
public double ScaleFactor {get; set;}
'Declaration Public Property ScaleFactor As Double
'Usage Dim instance As ImageBox Dim value As Double instance.ScaleFactor = value value = instance.ScaleFactor
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.
Imports Leadtools.Windows.Controls Public Sub ImageBox_ScaleFactor(ByVal viewer As ImageBox) 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
using Leadtools.Help; using Leadtools.Windows.Controls; public void ImageBox_ScaleFactor(ImageBox viewer) { viewer.ScaleFactor = viewer.ScaleFactor * 0.9f; string s = string.Format("HorizontalScaleFactor {0}, VerticalScaleFactor {1}", viewer.CurrentXScaleFactor, viewer.CurrentYScaleFactor); MessageBox.Show(s); }
using Leadtools.Help; using Leadtools.Windows.Controls; public void ImageBox_ScaleFactor(ImageBox viewer) { viewer.ScaleFactor = viewer.ScaleFactor * 0.9f; string s = string.Format("HorizontalScaleFactor {0}, VerticalScaleFactor {1}", viewer.CurrentXScaleFactor, viewer.CurrentYScaleFactor); MessageBox.Show(s); }
Imports Leadtools.Windows.Controls Public Sub ImageBox_ScaleFactor(ByVal viewer As ImageBox) 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.ImageBox" 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:ImageBox Name="theImage" Source="file:///c:\users\Public\Documents\LEADTOOLS Images\cannon.jpg" DockPanel.Dock= "Bottom" HorizontalAlignment="Center" VerticalAlignment="Bottom" ScaleFactor=".5"> </Leadtools_Windows_Controls:ImageBox> </DockPanel> </Window>