LEADTOOLS Windows Forms (Leadtools.WinForms assembly)
LEAD Technologies, Inc

SizeModeChanged Event (RasterPictureBox)

Example 





Occurs when the value of the SizeMode property changes.
Syntax
public event EventHandler SizeModeChanged
'Declaration
 
Public Event SizeModeChanged As EventHandler
'Usage
 
Dim instance As RasterPictureBox
Dim handler As EventHandler
 
AddHandler instance.SizeModeChanged, handler
public event EventHandler SizeModeChanged
add_SizeModeChanged(function(sender, e))
remove_SizeModeChanged(function(sender, e))

public:
event EventHandler^ SizeModeChanged
Remarks
This event is raised if the SizeMode property is changed by either a programmatic modification or user interaction.
Example
 
Private Sub viewer_SizeModeChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim viewer As RasterPictureBox = CType(IIf(TypeOf sender Is RasterPictureBox, sender, Nothing), RasterPictureBox)
    Dim s As String = String.Format("SizeModeChanged Event: {0}", viewer.SizeMode.ToString())
    MessageBox.Show(s)
End Sub
Public Sub RasterPictureBox_SizeModeChanged(ByVal viewer As RasterPictureBox)
    AddHandler viewer.SizeModeChanged, AddressOf viewer_SizeModeChanged

    Select Case viewer.SizeMode
        Case RasterPictureBoxSizeMode.AutoSize
            viewer.SizeMode = RasterPictureBoxSizeMode.CenterImage

        Case RasterPictureBoxSizeMode.CenterImage
            viewer.SizeMode = RasterPictureBoxSizeMode.Normal

        Case RasterPictureBoxSizeMode.Normal
            viewer.SizeMode = RasterPictureBoxSizeMode.StretchImage

        Case RasterPictureBoxSizeMode.StretchImage
            viewer.SizeMode = RasterPictureBoxSizeMode.Fit

        Case RasterPictureBoxSizeMode.Fit
            viewer.SizeMode = RasterPictureBoxSizeMode.AutoSize
    End Select

    RemoveHandler viewer.SizeModeChanged, AddressOf viewer_SizeModeChanged
End Sub
private void viewer_SizeModeChanged(object sender, EventArgs e)
{
   RasterPictureBox viewer = sender as RasterPictureBox;
   string s = string.Format("SizeModeChanged Event: {0}", viewer.SizeMode.ToString());
   MessageBox.Show(s);
}
public void RasterPictureBox_SizeModeChanged(RasterPictureBox viewer)
{
   viewer.SizeModeChanged += new EventHandler(viewer_SizeModeChanged);

   switch (viewer.SizeMode)
   {
      case RasterPictureBoxSizeMode.AutoSize:
         viewer.SizeMode = RasterPictureBoxSizeMode.CenterImage;
         break;

      case RasterPictureBoxSizeMode.CenterImage:
         viewer.SizeMode = RasterPictureBoxSizeMode.Normal;
         break;

      case RasterPictureBoxSizeMode.Normal:
         viewer.SizeMode = RasterPictureBoxSizeMode.StretchImage;
         break;

      case RasterPictureBoxSizeMode.StretchImage:
         viewer.SizeMode = RasterPictureBoxSizeMode.Fit;
         break;

      case RasterPictureBoxSizeMode.Fit:
         viewer.SizeMode = RasterPictureBoxSizeMode.AutoSize;
         break;
   }

   viewer.SizeModeChanged -= new EventHandler(viewer_SizeModeChanged);
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RasterPictureBox Class
RasterPictureBox Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.