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

Show in webframe

OnSizeModeChanged Method (ImageViewer)






A RoutedPropertyChangedEventArgs that contains the event data.
Raises the SizeModeChanged event.
Syntax
protected virtual void OnSizeModeChanged( 
   RoutedPropertyChangedEventArgs<SizeMode> e
)
'Declaration
 
Protected Overridable Sub OnSizeModeChanged( _
   ByVal e As RoutedPropertyChangedEventArgs(Of SizeMode) _
) 
'Usage
 
Dim instance As ImageViewer
Dim e As RoutedPropertyChangedEventArgs(Of SizeMode)
 
instance.OnSizeModeChanged(e)

            

            
protected:
virtual void OnSizeModeChanged( 
   RoutedPropertyChangedEventArgs<SizeMode>^ e
) 

Parameters

e
A RoutedPropertyChangedEventArgs that contains the event data.
Remarks

Raising an event invokes the event handler through a delegate.

The OnSizeModeChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors: When overriding OnSizeModeChanged in a derived class, be sure to call the base class's OnSizeModeChanged method so that registered delegates receive the event.

Example
Copy Code  
Imports Leadtools.Windows.Controls

Private Sub viewer_SizeModeChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim viewer As ImageViewer = TryCast(sender, ImageViewer)
    Dim s As String = String.Format("SizeModeChanged Event: {0}", viewer.SizeMode.ToString())
    MessageBox.Show(s)
End Sub

Public Sub BitmapSourceViewer_SizeModeChanged(ByVal viewer As ImageViewer)
    AddHandler viewer.SizeModeChanged, AddressOf viewer_SizeModeChanged

    Select Case viewer.SizeMode
        Case SizeMode.Fit
            viewer.SizeMode = SizeMode.FitAlways

        Case SizeMode.FitAlways
            viewer.SizeMode = SizeMode.FitWidth

        Case SizeMode.FitWidth
            viewer.SizeMode = SizeMode.Normal

        Case SizeMode.Normal
            viewer.SizeMode = SizeMode.Stretch

        Case SizeMode.Stretch
            viewer.SizeMode = SizeMode.Fit
    End Select

    RemoveHandler viewer.SizeModeChanged, AddressOf viewer_SizeModeChanged
End Sub
using Leadtools.Help;
using Leadtools.Windows.Controls;

private void viewer_SizeModeChanged(object sender, RoutedEventArgs e)
{
   ImageViewer viewer = sender as ImageViewer;
   string s = string.Format("SizeModeChanged Event: {0}", viewer.SizeMode.ToString());
   MessageBox.Show(s);
}

public void BitmapSourceViewer_SizeModeChanged(ImageViewer viewer)
{
   viewer.SizeModeChanged += new RoutedPropertyChangedEventHandler<SizeMode>(viewer_SizeModeChanged);

   switch(viewer.SizeMode)
   {
      case SizeMode.Fit:
         viewer.SizeMode = SizeMode.FitAlways;
         break;

      case SizeMode.FitAlways:
         viewer.SizeMode = SizeMode.FitWidth;
         break;

      case SizeMode.FitWidth:
         viewer.SizeMode = SizeMode.Normal;
         break;

      case SizeMode.Normal:
         viewer.SizeMode = SizeMode.Stretch;
         break;

      case SizeMode.Stretch:
         viewer.SizeMode = SizeMode.Fit;
         break;
   }

   viewer.SizeModeChanged -= new RoutedPropertyChangedEventHandler<SizeMode>(viewer_SizeModeChanged);
}
using Leadtools.Help;
using Leadtools.Windows.Controls;

private void viewer_SizeModeChanged(object sender, RoutedEventArgs e)
{
   ImageViewer viewer = sender as ImageViewer;
   string s = string.Format("SizeModeChanged Event: {0}", viewer.SizeMode.ToString());
   MessageBox.Show(s);
}

public void BitmapSourceViewer_SizeModeChanged(ImageViewer viewer)
{
   viewer.SizeModeChanged += new RoutedPropertyChangedEventHandler<SizeMode>(viewer_SizeModeChanged);

   switch(viewer.SizeMode)
   {
      case SizeMode.Fit:
         viewer.SizeMode = SizeMode.FitAlways;
         break;

      case SizeMode.FitAlways:
         viewer.SizeMode = SizeMode.FitWidth;
         break;

      case SizeMode.FitWidth:
         viewer.SizeMode = SizeMode.Normal;
         break;

      case SizeMode.Normal:
         viewer.SizeMode = SizeMode.Stretch;
         break;

      case SizeMode.Stretch:
         viewer.SizeMode = SizeMode.Fit;
         break;
   }

   viewer.SizeModeChanged -= new RoutedPropertyChangedEventHandler<SizeMode>(viewer_SizeModeChanged);
}
Imports Leadtools
Imports Leadtools.Windows.Controls

Private Sub viewer_SizeModeChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
   Dim viewer As ImageViewer = TryCast(sender, ImageViewer)
   Dim s As String = String.Format("SizeModeChanged Event: {0}", viewer.SizeMode.ToString())
   MessageBox.Show(s)
End Sub

Public Sub BitmapSourceViewer_SizeModeChanged(ByVal viewer As ImageViewer)
   AddHandler viewer.SizeModeChanged, AddressOf viewer_SizeModeChanged

   Select Case viewer.SizeMode
      Case SizeMode.Fit
         viewer.SizeMode = SizeMode.FitAlways

      Case SizeMode.FitAlways
         viewer.SizeMode = SizeMode.FitWidth

      Case SizeMode.FitWidth
         viewer.SizeMode = SizeMode.Normal

      Case SizeMode.Normal
         viewer.SizeMode = SizeMode.Stretch

      Case SizeMode.Stretch
         viewer.SizeMode = SizeMode.Fit
   End Select

   RemoveHandler viewer.SizeModeChanged, AddressOf viewer_SizeModeChanged
End Sub
Requirements

Target Platforms

See Also

Reference

ImageViewer Class
ImageViewer Members

Error processing SSI file