Gets or sets a value that determine how the control displays the image and the automatic adjustments of the display. This is a dependency property.
public Leadtools.Windows.Controls.SizeMode SizeMode {get; set;}Public Property SizeMode As Leadtools.Windows.Controls.SizeModepublic:property Leadtools.Windows.Controls.SizeMode SizeMode {Leadtools.Windows.Controls.SizeMode get();void set ( Leadtools.Windows.Controls.SizeMode );}
A SizeMode enumeration member value that determines how the control displays the image and the automatic adjustments of the display. Default value is SizeMode.Normal.
The control will use the base class FrameworkElement.MeasureOverride to determine how to fit the image in the viewing area.
When using the SizeMode.Normal size mode with; The image size is determined by the image physical pixel width and height and the values of the UseDpi and ScaleFactor properties. The AspectRatioCorrection will also play a role in determining the image size of its value is other than 1. The viewing area size is determined from the current pixel size of the control client area.
When the using the SizeMode.Fit, SizeMode.FitAlways, SizeMode.FitWidth and SizeMode.Stretch size modes; the value of ScaleFactor will always be reset back to 1 and will not be used. Instead, use the read only CurrentXScaleFactor and CurrentYScaleFactor properties to get the actual scale factors used. Note that AspectRatioCorrection will still be used.
Imports Leadtools.Windows.ControlsPrivate Class MyWindow1 : Inherits WindowPrivate theImage As ImageBoxPublic Sub New()' Create the viewertheImage = New ImageBox()' Create Dock PanelDim panel As DockPanel = New DockPanel()Content = panelDockPanel.SetDock(theImage, Dock.Bottom)theImage.HorizontalAlignment = HorizontalAlignment.CentertheImage.VerticalAlignment = VerticalAlignment.BottomtheImage.UseDpi = TruetheImage.ScreenDpiX = 96theImage.ScreenDpiY = 96panel.Children.Add(theImage)' load an image into the viewertheImage.Source = New BitmapImage(New Uri(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg")))Title = String.Format("Size mode = {0}, click to change", theImage.SizeMode)AddHandler theImage.MouseDown, AddressOf theImage_MouseClickEnd SubPrivate Sub theImage_MouseClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs)Select Case theImage.SizeModeCase SizeMode.NormaltheImage.SizeMode = SizeMode.StretchCase SizeMode.StretchtheImage.SizeMode = SizeMode.FitCase SizeMode.FittheImage.SizeMode = SizeMode.FitAlwaysCase SizeMode.FitAlwaystheImage.SizeMode = SizeMode.FitWidthCase SizeMode.FitWidththeImage.SizeMode = SizeMode.NormalEnd SelectTitle = String.Format("Size mode = {0}, double click to change", theImage.SizeMode)End SubEnd ClassPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools.Help;using Leadtools.Windows.Controls;class MyWindow1 : Window{ImageBox theImage;public MyWindow1(){// Create the viewertheImage = new ImageBox();// Create Dock PanelDockPanel panel = new DockPanel();Content = panel;DockPanel.SetDock(theImage, Dock.Bottom);theImage.HorizontalAlignment = HorizontalAlignment.Center;theImage.VerticalAlignment= VerticalAlignment.Bottom;theImage.UseDpi = true;theImage.ScreenDpiX = 96;theImage.ScreenDpiY = 96;panel.Children.Add(theImage);// load an image into the viewertheImage.Source = new BitmapImage(new Uri(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg")));Title = string.Format("Size mode = {0}, click to change", theImage.SizeMode);theImage.MouseDown += new MouseButtonEventHandler(theImage_MouseClick);}void theImage_MouseClick(object sender, MouseButtonEventArgs e){switch(theImage.SizeMode){case SizeMode.Normal:theImage.SizeMode = SizeMode.Stretch;break;case SizeMode.Stretch:theImage.SizeMode = SizeMode.Fit;break;case SizeMode.Fit:theImage.SizeMode = SizeMode.FitAlways;break;case SizeMode.FitAlways:theImage.SizeMode = SizeMode.FitWidth;break;case SizeMode.FitWidth:theImage.SizeMode = SizeMode.Normal;break;}Title = string.Format("Size mode = {0}, double click to change", theImage.SizeMode);}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
using Leadtools.Help;using Leadtools.Windows.Controls;class MyWindow1 : ChildWindow{ImageBox theImage;public MyWindow1(){// Create the viewertheImage = new ImageBox();// Create Dock PanelStackPanel panel = new StackPanel();Content = panel;theImage.HorizontalAlignment = HorizontalAlignment.Center;theImage.VerticalAlignment= VerticalAlignment.Bottom;theImage.UseDpi = true;theImage.ScreenDpiX = 96;theImage.ScreenDpiY = 96;panel.Children.Add(theImage);// load an image into the viewertheImage.Source = new BitmapImage(new Uri(LeadtoolsExamples.Common.ImagesPath.Path + "cannon.jpg"));Title = string.Format("Size mode = {0}, click to change", theImage.SizeMode);theImage.MouseLeftButtonDown +=new MouseButtonEventHandler(theImage_MouseLeftButtonDown);}void theImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e){switch (theImage.SizeMode){case SizeMode.Normal:theImage.SizeMode = SizeMode.Stretch;break;case SizeMode.Stretch:theImage.SizeMode = SizeMode.Fit;break;case SizeMode.Fit:theImage.SizeMode = SizeMode.FitAlways;break;case SizeMode.FitAlways:theImage.SizeMode = SizeMode.FitWidth;break;case SizeMode.FitWidth:theImage.SizeMode = SizeMode.Normal;break;}Title = string.Format("Size mode = {0}, double click to change", theImage.SizeMode);}}
Imports Leadtools.Windows.ControlsPrivate Class MyWindow1 : Inherits ChildWindowPrivate theImage As ImageBoxPublic Sub New()' Create the viewertheImage = New ImageBox()' Create Dock PanelDim panel As StackPanel = New StackPanel()Content = paneltheImage.HorizontalAlignment = HorizontalAlignment.CentertheImage.VerticalAlignment= VerticalAlignment.BottomtheImage.UseDpi = TruetheImage.ScreenDpiX = 96theImage.ScreenDpiY = 96panel.Children.Add(theImage)' load an image into the viewertheImage.Source = New BitmapImage(New Uri(LeadtoolsExamples.Common.ImagesPath.Path & "cannon.jpg"))Title = String.Format("Size mode = {0}, click to change", theImage.SizeMode)AddHandler theImage.MouseLeftButtonDown, AddressOf theImage_MouseLeftButtonDownEnd SubPrivate Sub theImage_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)Select Case theImage.SizeModeCase SizeMode.NormaltheImage.SizeMode = SizeMode.StretchCase SizeMode.StretchtheImage.SizeMode = SizeMode.FitCase SizeMode.FittheImage.SizeMode = SizeMode.FitAlwaysCase SizeMode.FitAlwaystheImage.SizeMode = SizeMode.FitWidthCase SizeMode.FitWidththeImage.SizeMode = SizeMode.NormalEnd SelectTitle = String.Format("Size mode = {0}, double click to change", theImage.SizeMode)End SubEnd Class
<!--WPF example--><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:ImageBoxName="theImage"Source="file:///c:\users\Public\Documents\LEADTOOLS Images\cannon.jpg"DockPanel.Dock= "Bottom"HorizontalAlignment="Center" VerticalAlignment="Bottom" SizeMode="Fit" UseDpi="true"></Leadtools_Windows_Controls:ImageBox ></DockPanel><Window.Title>"Apply a effect"</Window.Title></Window><!--Silverlight example--><UserControl x:Class="SilverlightApplication1.MainPage"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"mc:Ignorable="d"d:DesignHeight="300" d:DesignWidth="400"><Grid x:Name="LayoutRoot" Background="White"><Leadtools_Windows_Controls:ImageBox Name="theImage" Source="http://www.MyServer.com/images/MyImage.png" HorizontalAlignment="Center" VerticalAlignment="Bottom" SizeMode="Fit" UseDpi="true"></Leadtools_Windows_Controls:ImageBox ></Grid></UserControl>
|
Products |
Support |
Feedback: SizeMode Property (ImageBox) - Leadtools.Windows.Controls |
Introduction |
Help Version 19.0.2017.3.22
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.