Leadtools.WinForms Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.8.31
SizeModeChanged Event
See Also  Example
Leadtools.WinForms Namespace > RasterImagePrinter 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 RasterImagePrinter
Dim handler As EventHandler
 
AddHandler instance.SizeModeChanged, handler
C# 
public event EventHandler SizeModeChanged()
Managed Extensions for C++ 
public: __event EventHandler* SizeModeChanged();
C++/CLI 
public:
event EventHandler^ SizeModeChanged();

Example

This example uses events to detect changes to a RasterImagePrinter object.

Visual BasicCopy Code
Public Sub RasterImagePrinter_SizeModeChanged()
   Dim printer As RasterImagePrinter = New RasterImagePrinter()
   ' add the event handlers
   AddHandler printer.HorizontalAlignModeChanged, AddressOf printer_HorizontalAlignModeChanged
   AddHandler printer.VerticalAlignModeChanged, AddressOf printer_VerticalAlignModeChanged
   AddHandler printer.ImageRectangleChanged, AddressOf printer_ImageRectangleChanged
   AddHandler printer.PageRectangleChanged, AddressOf printer_PageRectangleChanged
   AddHandler printer.PaintPropertiesChanged, AddressOf printer_PaintPropertiesChanged
   AddHandler printer.SizeModeChanged, AddressOf printer_SizeModeChanged

   ' set the properties
   printer.HorizontalAlignMode = RasterPaintAlignMode.Near
   printer.VerticalAlignMode = RasterPaintAlignMode.Near
   printer.ImageRectangle = New Rectangle(0, 0, 100, 100)
   printer.PageRectangle = printer.ImageRectangle
   printer.PaintProperties = New RasterPaintProperties()
   printer.SizeMode = RasterPaintSizeMode.Stretch

   ' remove event handlers
   RemoveHandler printer.HorizontalAlignModeChanged, AddressOf printer_HorizontalAlignModeChanged
   RemoveHandler printer.VerticalAlignModeChanged, AddressOf printer_VerticalAlignModeChanged
   RemoveHandler printer.ImageRectangleChanged, AddressOf printer_ImageRectangleChanged
   RemoveHandler printer.PageRectangleChanged, AddressOf printer_PageRectangleChanged
   RemoveHandler printer.PaintPropertiesChanged, AddressOf printer_PaintPropertiesChanged
   RemoveHandler printer.SizeModeChanged, AddressOf printer_SizeModeChanged
End Sub

Private Sub printer_HorizontalAlignModeChanged(ByVal sender As Object, ByVal e As EventArgs)
   Dim printer As RasterImagePrinter = CType(sender, RasterImagePrinter)
   If Not printer Is Nothing Then
      Console.WriteLine("HorizontalAlignModeChanged: {0}", printer.HorizontalAlignMode.ToString())
   End If
End Sub

Private Sub printer_VerticalAlignModeChanged(ByVal sender As Object, ByVal e As EventArgs)
   Dim printer As RasterImagePrinter = CType(sender, RasterImagePrinter)
   If Not printer Is Nothing Then
      Console.WriteLine("VerticalAlignModeChanged: {0}", printer.VerticalAlignMode.ToString())
   End If
End Sub

Private Sub printer_ImageRectangleChanged(ByVal sender As Object, ByVal e As EventArgs)
   Dim printer As RasterImagePrinter = CType(sender, RasterImagePrinter)
   If Not printer Is Nothing Then
      Console.WriteLine("ImageRectangleChanged: {0}", printer.ImageRectangle.ToString())
   End If
End Sub

Private Sub printer_PageRectangleChanged(ByVal sender As Object, ByVal e As EventArgs)
   Dim printer As RasterImagePrinter = CType(sender, RasterImagePrinter)
   If Not printer Is Nothing Then
      Console.WriteLine("PageRectangleChanged: {0}", printer.PageRectangle.ToString())
   End If
End Sub

Private Sub printer_PaintPropertiesChanged(ByVal sender As Object, ByVal e As EventArgs)
   Dim printer As RasterImagePrinter = CType(sender, RasterImagePrinter)
   If Not printer Is Nothing Then
      Console.WriteLine("PaintPropertiesChanged")
      Console.WriteLine(Constants.vbTab & "PaintDisplayMode {0} ", printer.PaintProperties.PaintDisplayMode.ToString())
      Console.WriteLine(Constants.vbTab & "PaintEngine {0} ", printer.PaintProperties.PaintEngine.ToString())
      Console.WriteLine(Constants.vbTab & "RasterOperation {0} ", printer.PaintProperties.RasterOperation.ToString())
      Console.WriteLine(Constants.vbTab & "UsePaintPalette {0} ", printer.PaintProperties.UsePaintPalette.ToString())
   End If
End Sub

Private Sub printer_SizeModeChanged(ByVal sender As Object, ByVal e As EventArgs)
   Dim printer As RasterImagePrinter = CType(sender, RasterImagePrinter)
   If Not printer Is Nothing Then
      Console.WriteLine("SizeModeChanged: {0}", printer.SizeMode.ToString())
   End If
End Sub
C#Copy Code
public void RasterImagePrinter_SizeModeChanged() 

   RasterImagePrinter printer = new RasterImagePrinter(); 
   // add the event handlers 
   printer.HorizontalAlignModeChanged += new EventHandler(printer_HorizontalAlignModeChanged); 
   printer.VerticalAlignModeChanged += new EventHandler(printer_VerticalAlignModeChanged); 
   printer.ImageRectangleChanged += new EventHandler(printer_ImageRectangleChanged); 
   printer.PageRectangleChanged += new EventHandler(printer_PageRectangleChanged); 
   printer.PaintPropertiesChanged += new EventHandler(printer_PaintPropertiesChanged); 
   printer.SizeModeChanged += new EventHandler(printer_SizeModeChanged); 
 
   // set the properties 
   printer.HorizontalAlignMode = RasterPaintAlignMode.Near; 
   printer.VerticalAlignMode = RasterPaintAlignMode.Near; 
   printer.ImageRectangle = new Rectangle(0, 0, 100, 100); 
   printer.PageRectangle = printer.ImageRectangle; 
   printer.PaintProperties = new RasterPaintProperties(); 
   printer.SizeMode = RasterPaintSizeMode.Stretch; 
 
   // remove event handlers 
   printer.HorizontalAlignModeChanged -= new EventHandler(printer_HorizontalAlignModeChanged); 
   printer.VerticalAlignModeChanged -= new EventHandler(printer_VerticalAlignModeChanged); 
   printer.ImageRectangleChanged -= new EventHandler(printer_ImageRectangleChanged); 
   printer.PageRectangleChanged -= new EventHandler(printer_PageRectangleChanged); 
   printer.PaintPropertiesChanged -= new EventHandler(printer_PaintPropertiesChanged); 
   printer.SizeModeChanged -= new EventHandler(printer_SizeModeChanged); 

 
void printer_HorizontalAlignModeChanged(object sender, EventArgs e) 

   RasterImagePrinter printer = (RasterImagePrinter)sender; 
   if(printer != null) 
      Console.WriteLine("HorizontalAlignModeChanged: {0}", printer.HorizontalAlignMode.ToString()); 

 
void printer_VerticalAlignModeChanged(object sender, EventArgs e) 

   RasterImagePrinter printer = (RasterImagePrinter)sender; 
   if(printer != null) 
      Console.WriteLine("VerticalAlignModeChanged: {0}", printer.VerticalAlignMode.ToString()); 

 
void printer_ImageRectangleChanged(object sender, EventArgs e) 

   RasterImagePrinter printer = (RasterImagePrinter)sender; 
   if(printer != null) 
      Console.WriteLine("ImageRectangleChanged: {0}", printer.ImageRectangle.ToString()); 

 
void printer_PageRectangleChanged(object sender, EventArgs e) 

   RasterImagePrinter printer = (RasterImagePrinter)sender; 
   if(printer != null) 
      Console.WriteLine("PageRectangleChanged: {0}", printer.PageRectangle.ToString()); 

 
void printer_PaintPropertiesChanged(object sender, EventArgs e) 

   RasterImagePrinter printer = (RasterImagePrinter)sender; 
   if(printer != null) 
   { 
      Console.WriteLine("PaintPropertiesChanged"); 
      Console.WriteLine("\tPaintDisplayMode {0} ", printer.PaintProperties.PaintDisplayMode.ToString()); 
      Console.WriteLine("\tPaintEngine {0} ", printer.PaintProperties.PaintEngine.ToString()); 
      Console.WriteLine("\tRasterOperation {0} ", printer.PaintProperties.RasterOperation.ToString()); 
      Console.WriteLine("\tUsePaintPalette {0} ", printer.PaintProperties.UsePaintPalette.ToString()); 
   } 

 
void printer_SizeModeChanged(object sender, EventArgs e) 

   RasterImagePrinter printer = (RasterImagePrinter)sender; 
   if(printer != null) 
      Console.WriteLine("SizeModeChanged: {0}", printer.SizeMode.ToString()); 
}

Remarks

This event is raised if the SizeMode property is changed.

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