Leadtools.WinForms Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
SizeModeChanged Event
See Also  Example
Leadtools.WinForms Namespace > RasterImageViewer Class : SizeModeChanged Event



Occurs when the value of the SizeMode property changes.

Syntax

Visual Basic (Declaration) 
Public Event SizeModeChanged() As EventHandler
Visual Basic (Usage)Copy Code
Dim instance As RasterImageViewer
Dim handler As EventHandler
 
AddHandler instance.SizeModeChanged, handler
C# 
public event EventHandler SizeModeChanged()
C++/CLI 
public:
event EventHandler^ SizeModeChanged();

Example

This example uses the SizeModeChanged event to show how the SizeMode has changed.

Visual BasicCopy Code
Private Sub viewer_SizeModeChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim viewer As RasterImageViewer = CType(IIf(TypeOf sender Is RasterImageViewer, sender, Nothing), RasterImageViewer)
    Dim s As String = String.Format("SizeModeChanged Event: {0}", viewer.SizeMode.ToString())
    MessageBox.Show(s)
End Sub
Public Sub RasterImageViewer_SizeModeChanged(ByVal viewer As RasterImageViewer)
    AddHandler viewer.SizeModeChanged, AddressOf viewer_SizeModeChanged

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

        Case RasterPaintSizeMode.FitAlways
            viewer.SizeMode = RasterPaintSizeMode.FitWidth

        Case RasterPaintSizeMode.FitWidth
            viewer.SizeMode = RasterPaintSizeMode.Normal

        Case RasterPaintSizeMode.Normal
            viewer.SizeMode = RasterPaintSizeMode.Stretch

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

    RemoveHandler viewer.SizeModeChanged, AddressOf viewer_SizeModeChanged
End Sub
C#Copy Code
private void viewer_SizeModeChanged(object sender, EventArgs e) 

   RasterImageViewer viewer = sender as RasterImageViewer; 
   string s = string.Format("SizeModeChanged Event: {0}", viewer.SizeMode.ToString()); 
   MessageBox.Show(s); 

public void RasterImageViewer_SizeModeChanged(RasterImageViewer viewer) 

   viewer.SizeModeChanged += new EventHandler(viewer_SizeModeChanged); 
 
   switch (viewer.SizeMode) 
   { 
      case RasterPaintSizeMode.Fit: 
         viewer.SizeMode = RasterPaintSizeMode.FitAlways; 
         break; 
 
      case RasterPaintSizeMode.FitAlways: 
         viewer.SizeMode = RasterPaintSizeMode.FitWidth; 
         break; 
 
      case RasterPaintSizeMode.FitWidth: 
         viewer.SizeMode = RasterPaintSizeMode.Normal; 
         break; 
 
      case RasterPaintSizeMode.Normal: 
         viewer.SizeMode = RasterPaintSizeMode.Stretch; 
         break; 
 
      case RasterPaintSizeMode.Stretch: 
         viewer.SizeMode = RasterPaintSizeMode.Fit; 
         break; 
   } 
 
   viewer.SizeModeChanged -= new EventHandler(viewer_SizeModeChanged); 
}

Remarks

This event is raised if the SizeMode property is changed by either a programmatic modification or user interaction.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also