←Select platform

ResetImageViewOptions Property

Summary

Gets or sets a value that determines which properties gets reset when a new image is set into the Source property. This is a dependency property.

Syntax

C#
VB
C++
public ResetImageViewOptions ResetImageViewOptions { get; set; } 
  
Public Property ResetImageViewOptions As Leadtools.Windows.Controls.ResetImageViewOptions 

Property Value

One or more of the ResetImageViewOptions enumeration members that determine which properties gets reset to their default values when a new image is set into the Source properties. Default value is ResetImageViewOptions.All.

Remarks

You can use this property to control which of the display properties of the controls resets back to its default value when a new image is set into the Source property.

The following table lists the options than can be specified:

Option Description
ResetImageViewOptions.None

None of the following properties will reset back to their default values, instead they will keep their current values when a new image is set in Source.

ResetImageViewOptions.ScrollPosition

The horizontal and vertical bars (if applicable) location will reset back to the top-left position.

ResetImageViewOptions.ScaleFactor

The ScaleFactor property will reset back to 1.0.

ResetImageViewOptions.AspectRatioCorrection

The AspectRatioCorrection property will reset back to 1.0.

ResetImageViewOptions.SizeMode

The SizeMode property will reset back to SizeMode.Normal.

ResetImageViewOptions.Reverse

The Reverse property will reset back to false.

ResetImageViewOptions.Flip

The Flip property will reset back to false.

ResetImageViewOptions.RotateAngle

The RotateAngle property will reset back to 0.

ResetImageViewOptions.All

All the above properties will reset back to their default values.

You can use a logical OR operation to combine any of the above options together. By setting these options, you can achieve effects such as if the control has a scale factor value of 1.5 (150 percent) and a new image is set, the scale factor does not reset and stays at 150 percent instead of going back to 100 percent.

Example

C#
VB
Silverlight C#
Silverlight VB
using Leadtools.Help; 
using Leadtools.Windows.Controls; 
 
class ResetImageViewOptionsWindow : Window 
{ 
   ImageBox theImage; 
 
   public ResetImageViewOptionsWindow() 
   { 
      // Create the  viewer 
      theImage = new ImageBox(); 
 
      // Create Dock Panel 
 
      DockPanel panel = new DockPanel(); 
      Content = panel; 
 
      DockPanel.SetDock(theImage, Dock.Bottom); 
 
      theImage.HorizontalAlignment = HorizontalAlignment.Center; 
      theImage.VerticalAlignment = VerticalAlignment.Bottom; 
 
      panel.Children.Add(theImage); 
 
      // load an image into the viewer 
      theImage.Source = new BitmapImage(new Uri(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"))); 
      theImage.SizeMode = SizeMode.Fit; 
 
      Title = string.Format("Size mode = {0}, click to change", theImage.SizeMode); 
 
      theImage.MouseDown += new MouseButtonEventHandler(theImage_MouseClick); 
   } 
 
   void theImage_MouseClick(object sender, MouseButtonEventArgs e) 
   { 
      // Assign a new image and keep the size mode set to fit. 
      theImage.ResetImageViewOptions = ResetImageViewOptions.All & ~ResetImageViewOptions.SizeMode; 
      theImage.Source = new BitmapImage(new Uri(Path.Combine(LEAD_VARS.ImagesDir, "LittleGFlyingAlpha.png"))); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 
Imports Leadtools.Windows.Controls 
 
Private Class ResetImageViewOptionsWindow : Inherits Window 
   Private theImage As ImageBox 
 
   Public Sub New() 
      ' Create the  viewer 
      theImage = New ImageBox() 
 
      ' Create Dock Panel 
 
      Dim panel As DockPanel = New DockPanel() 
      Content = panel 
 
      DockPanel.SetDock(theImage, Dock.Bottom) 
 
      theImage.HorizontalAlignment = HorizontalAlignment.Center 
      theImage.VerticalAlignment = VerticalAlignment.Bottom 
 
      panel.Children.Add(theImage) 
 
      ' load an image into the viewer 
      theImage.Source = New BitmapImage(New Uri(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"))) 
      theImage.SizeMode = SizeMode.Fit 
 
      Title = String.Format("Size mode = {0}, click to change", theImage.SizeMode) 
 
      AddHandler theImage.MouseDown, AddressOf theImage_MouseClick 
   End Sub 
 
   Private Sub theImage_MouseClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs) 
      ' Assign a new image and keep the size mode set to fit. 
      theImage.ResetImageViewOptions = ResetImageViewOptions.All And Not ResetImageViewOptions.SizeMode 
      theImage.Source = New BitmapImage(New Uri(Path.Combine(LEAD_VARS.ImagesDir, "LittleGFlyingAlpha.png"))) 
   End Sub 
End Class 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
using Leadtools.Help; 
using Leadtools.Windows.Controls; 
 
class ResetImageViewOptionsWindow : ChildWindow 
{ 
   ImageBox theImage; 
 
   public ResetImageViewOptionsWindow() 
   { 
      // Create the  viewer 
      theImage = new ImageBox(); 
 
      // Create Dock Panel 
 
      StackPanel panel = new StackPanel(); 
      Content = panel; 
 
      theImage.HorizontalAlignment = HorizontalAlignment.Center; 
      theImage.VerticalAlignment = VerticalAlignment.Bottom; 
 
      panel.Children.Add(theImage); 
 
      // load an image into the viewer 
      theImage.Source = new BitmapImage(new Uri(LeadtoolsExamples.Common.ImagesPath.Path + "cannon.jpg")); 
      theImage.SizeMode = SizeMode.Fit; 
 
      Title = string.Format("Size mode = {0}, click to change", theImage.SizeMode); 
 
      theImage.MouseLeftButtonDown += new MouseButtonEventHandler(theImage_MouseLeftButtonDown); 
   } 
 
   void theImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 
   { 
      // Assign a new image and keep the size mode set to fit. 
      theImage.ResetImageViewOptions = ResetImageViewOptions.All & ~ResetImageViewOptions.SizeMode; 
      theImage.Source = new BitmapImage(new Uri(LeadtoolsExamples.Common.ImagesPath.Path + "LittleGFlyingAlpha.png")); 
   } 
} 
Imports Leadtools.Windows.Controls 
 
Private Class ResetImageViewOptionsWindow : Inherits ChildWindow 
   Private theImage As ImageBox 
 
   Public Sub New() 
      ' Create the  viewer 
      theImage = New ImageBox() 
 
      ' Create Dock Panel 
 
      Dim panel As StackPanel = New StackPanel() 
      Content = panel 
 
      theImage.HorizontalAlignment = HorizontalAlignment.Center 
      theImage.VerticalAlignment = VerticalAlignment.Bottom 
 
      panel.Children.Add(theImage) 
 
      ' load an image into the viewer 
      theImage.Source = New BitmapImage(New Uri(LeadtoolsExamples.Common.ImagesPath.Path & "cannon.jpg")) 
      theImage.SizeMode = SizeMode.Fit 
 
      Title = String.Format("Size mode = {0}, click to change", theImage.SizeMode) 
 
      AddHandler theImage.MouseLeftButtonDown, AddressOf theImage_MouseLeftButtonDown 
   End Sub 
 
   Private Sub theImage_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs) 
      ' Assign a new image and keep the size mode set to fit. 
      theImage.ResetImageViewOptions = ResetImageViewOptions.All And Not ResetImageViewOptions.SizeMode 
      theImage.Source = New BitmapImage(New Uri(LeadtoolsExamples.Common.ImagesPath.Path & "LittleGFlyingAlpha.png")) 
   End Sub 
End Class 

Requirements

Target Platforms

See Also

Reference

ImageBox Class

ImageBox Members

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Windows.Controls Assembly