Error processing SSI file
LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly)

Show in webframe

ResetImageViewOptions Property (ImageViewer)






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
public ResetImageViewOptions ResetImageViewOptions {get; set;}
'Declaration
 
Public Property ResetImageViewOptions As ResetImageViewOptions
'Usage
 
Dim instance As ImageViewer
Dim value As ResetImageViewOptions
 
instance.ResetImageViewOptions = value
 
value = instance.ResetImageViewOptions

            

            
public:
property ResetImageViewOptions ResetImageViewOptions {
   ResetImageViewOptions get();
   void set (    ResetImageViewOptions value);
}

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
Copy Code  
Imports Leadtools.Windows.Controls

Private Class ResetImageViewOptionsWindow : Inherits Window
    Private theImage As ImageViewer
    Public Sub New()
        ' Create the  viewer
        theImage = New ImageViewer()

        ' 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 : Window
{
   ImageViewer theImage;
   public ResetImageViewOptionsWindow()
   {
      // Create the  viewer
      theImage = new ImageViewer();

      // 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";
}
using Leadtools.Help;
using Leadtools.Windows.Controls;

class ResetImageViewOptionsWindow : ChildWindow
{
   ImageViewer theImage;
   public ResetImageViewOptionsWindow()
   {
      // Create the  viewer
      theImage = new ImageViewer();

      // 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
Imports Leadtools.Windows.Controls

Private Class ResetImageViewOptionsWindow : Inherits ChildWindow
   Private theImage As ImageViewer
   Public Sub New()
      ' Create the  viewer
      theImage = New ImageViewer()

      ' 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
<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="Bottom" SizeMode="Fit" ResetImageViewOptions="All">

    </Leadtools_Windows_Controls:ImageViewer >
  
</DockPanel>
  <Window.Title>
    "Reset Image View Options"
  </Window.Title>
</Window>
Requirements

Target Platforms

See Also

Reference

ImageViewer Class
ImageViewer Members

Error processing SSI file