Leadtools.WinForms Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.8.31
OnPaint Method
See Also  Example
Leadtools.WinForms Namespace > RasterImageList Class : OnPaint Method




e
A PaintEventArgs that contains the event data.
This member overrides Control.OnPaint.

Syntax

Visual Basic (Declaration) 
Overrides Protected Sub OnPaint( _
   ByVal e As PaintEventArgs _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterImageList
Dim e As PaintEventArgs
 
instance.OnPaint(e)
C# 
protected override void OnPaint( 
   PaintEventArgs e
)
Managed Extensions for C++ 
protected: void OnPaint( 
   PaintEventArgs e
) override 
C++/CLI 
protected:
void OnPaint( 
   PaintEventArgs e
) override 

Parameters

e
A PaintEventArgs that contains the event data.

Example

This example overrides the virtual events of the RasterImageList class.

Visual BasicCopy Code
Public Class MyRasterImageList
   Inherits RasterImageList
   '.
   '.
   '.
   Protected Overrides Sub OnAutoDeselectItemsChanged(ByVal e As EventArgs)
      MyBase.OnAutoDeselectItemsChanged(e)
      Console.WriteLine("OnAutoDeselectItemsChanged is called")
   End Sub

   Protected Overrides Sub OnAutoDisposeImagesChanged(ByVal e As EventArgs)
      MyBase.OnAutoDisposeImagesChanged(e)
      Console.WriteLine("OnAutoDisposeImagesChanged is called")
   End Sub

   Protected Overrides Sub OnBorderStyleChanged(ByVal e As EventArgs)
      MyBase.OnBorderStyleChanged(e)
      Console.WriteLine("OnBorderStyleChanged is called")
   End Sub

   Protected Overrides Sub OnDoubleBufferChanged(ByVal e As EventArgs)
      MyBase.OnDoubleBufferChanged(e)
      Console.WriteLine("OnDoubleBufferChanged is called")
   End Sub

   Protected Overrides Sub OnDrawItem(ByVal e As RasterImageListDrawItemEventArgs)
      MyBase.OnDrawItem(e)
      Console.WriteLine("OnDrawItem is called")
   End Sub

   Protected Overrides Sub OnEnableKeyboardChanged(ByVal e As EventArgs)
      MyBase.OnEnableKeyboardChanged(e)
      Console.WriteLine("OnEnableKeyboardChanged is called")
   End Sub

   Protected Overrides Sub OnEnableRubberBandSelectionChanged(ByVal e As EventArgs)
      MyBase.OnEnableRubberBandSelectionChanged(e)
      Console.WriteLine("OnEnableRubberBandSelectionChanged is called")
   End Sub

   Protected Overrides Sub OnItemBackColorChanged(ByVal e As EventArgs)
      MyBase.OnItemBackColorChanged(e)
      Console.WriteLine("OnItemBackColorChanged is called")
   End Sub

   Protected Overrides Sub OnItemBorderStyleChanged(ByVal e As EventArgs)
      MyBase.OnItemBorderStyleChanged(e)
      Console.WriteLine("OnItemBorderStyleChanged is called")
   End Sub

   Protected Overrides Sub OnItemForeColorChanged(ByVal e As EventArgs)
      MyBase.OnItemForeColorChanged(e)
      Console.WriteLine("OnItemForeColorChanged is called")
   End Sub

   Protected Overrides Sub OnItemImageBorderStyleChanged(ByVal e As EventArgs)
      MyBase.OnItemImageBorderStyleChanged(e)
      Console.WriteLine("OnItemImageBorderStyleChanged is called")
   End Sub

   Protected Overrides Sub OnItemImageSizeChanged(ByVal e As EventArgs)
      MyBase.OnItemImageSizeChanged(e)
      Console.WriteLine("OnItemImageSizeChanged is called")
   End Sub

   Protected Overrides Sub OnItemSelectedBackColorChanged(ByVal e As EventArgs)
      MyBase.OnItemSelectedBackColorChanged(e)
      Console.WriteLine("OnItemSelectedBackColorChanged is called")
   End Sub

   Protected Overrides Sub OnItemSelectedForeColorChanged(ByVal e As EventArgs)
      MyBase.OnItemSelectedForeColorChanged(e)
      Console.WriteLine("OnItemSelectedForeColorChanged is called")
   End Sub

   Protected Overrides Sub OnItemSizeChanged(ByVal e As EventArgs)
      MyBase.OnItemSizeChanged(e)
      Console.WriteLine("OnItemSizeChanged is called")
   End Sub

   Protected Overrides Sub OnItemSpacingSizeChanged(ByVal e As EventArgs)
      MyBase.OnItemSpacingSizeChanged(e)
      Console.WriteLine("OnItemSpacingSizeChanged is called")
   End Sub

   Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
      MyBase.OnKeyDown(e)
      Console.WriteLine("OnKeyDown is called")
   End Sub

   Protected Overrides Sub OnLostFocus(ByVal e As EventArgs)
      MyBase.OnLostFocus(e)
      Console.WriteLine("OnLostFocus is called")
   End Sub

   Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
      MyBase.OnMouseDown(e)
      Console.WriteLine("OnMouseDown is called")
   End Sub

   Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
      MyBase.OnMouseMove(e)
      Console.WriteLine("OnMouseMove is called")
   End Sub

   Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
      MyBase.OnMouseUp(e)
      Console.WriteLine("OnMouseUp is called")
   End Sub

   Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
      MyBase.OnPaint(e)
      Console.WriteLine("OnPaint is called")
   End Sub

   Protected Overrides Sub OnPaintPropertiesChanged(ByVal e As EventArgs)
      MyBase.OnPaintPropertiesChanged(e)
      Console.WriteLine("OnPaintPropertiesChanged is called")
   End Sub

   Protected Overrides Sub OnScroll(ByVal e As EventArgs)
      MyBase.OnScroll(e)
      Console.WriteLine("OnScroll is called")
   End Sub

   Protected Overrides Sub OnScrollStyleChanged(ByVal e As EventArgs)
      MyBase.OnScrollStyleChanged(e)
      Console.WriteLine("OnScrollStyleChanged is called")
   End Sub

   Protected Overrides Sub OnSelectedIndexChanged(ByVal e As EventArgs)
      MyBase.OnSelectedIndexChanged(e)
      Console.WriteLine("OnSelectedIndexChanged is called")
   End Sub

   Protected Overrides Sub OnSelectionModeChanged(ByVal e As EventArgs)
      MyBase.OnSelectionModeChanged(e)
      Console.WriteLine("OnSelectionModeChanged is called")
   End Sub

   Protected Overrides Sub OnSelectUserImageChanged(ByVal e As EventArgs)
      MyBase.OnSelectUserImageChanged(e)
      Console.WriteLine("OnSelectUserImageChanged is called")
   End Sub

   Protected Overrides Sub OnShowItemTextChanged(ByVal e As EventArgs)
      MyBase.OnShowItemTextChanged(e)
      Console.WriteLine("OnShowItemTextChanged is called")
   End Sub

   Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
      MyBase.OnSizeChanged(e)
      Console.WriteLine("OnSizeChanged is called")
   End Sub

   Protected Overrides Sub OnSorterChanged(ByVal e As EventArgs)
      MyBase.OnSorterChanged(e)
      Console.WriteLine("OnSorterChanged is called")
   End Sub

   Protected Overrides Sub OnSortingChanged(ByVal e As EventArgs)
      MyBase.OnSortingChanged(e)
      Console.WriteLine("OnSortingChanged is called")
   End Sub

   Protected Overrides Sub OnViewStyleChanged(ByVal e As EventArgs)
      MyBase.OnViewStyleChanged(e)
      Console.WriteLine("OnViewStyleChanged is called")
   End Sub
End Class
C#Copy Code
public class MyRasterImageList : RasterImageList 

   //. 
   //. 
   //. 
   protected override void OnAutoDeselectItemsChanged(EventArgs e) 
   { 
      base.OnAutoDeselectItemsChanged(e); 
      Console.WriteLine("OnAutoDeselectItemsChanged is called"); 
   } 
 
   protected override void OnAutoDisposeImagesChanged(EventArgs e) 
   { 
      base.OnAutoDisposeImagesChanged(e); 
      Console.WriteLine("OnAutoDisposeImagesChanged is called"); 
   } 
 
   protected override void OnBorderStyleChanged(EventArgs e) 
   { 
      base.OnBorderStyleChanged(e); 
      Console.WriteLine("OnBorderStyleChanged is called"); 
   } 
 
   protected override void OnDoubleBufferChanged(EventArgs e) 
   { 
      base.OnDoubleBufferChanged(e); 
      Console.WriteLine("OnDoubleBufferChanged is called"); 
   } 
 
   protected override void OnDrawItem(RasterImageListDrawItemEventArgs e) 
   { 
      base.OnDrawItem(e); 
      Console.WriteLine("OnDrawItem is called"); 
   } 
 
   protected override void OnEnableKeyboardChanged(EventArgs e) 
   { 
      base.OnEnableKeyboardChanged(e); 
      Console.WriteLine("OnEnableKeyboardChanged is called"); 
   } 
 
   protected override void OnEnableRubberBandSelectionChanged(EventArgs e) 
   { 
      base.OnEnableRubberBandSelectionChanged(e); 
      Console.WriteLine("OnEnableRubberBandSelectionChanged is called"); 
   } 
 
   protected override void OnItemBackColorChanged(EventArgs e) 
   { 
      base.OnItemBackColorChanged(e); 
      Console.WriteLine("OnItemBackColorChanged is called"); 
   } 
 
   protected override void OnItemBorderStyleChanged(EventArgs e) 
   { 
      base.OnItemBorderStyleChanged(e); 
      Console.WriteLine("OnItemBorderStyleChanged is called"); 
   } 
 
   protected override void OnItemForeColorChanged(EventArgs e) 
   { 
      base.OnItemForeColorChanged(e); 
      Console.WriteLine("OnItemForeColorChanged is called"); 
   } 
 
   protected override void OnItemImageBorderStyleChanged(EventArgs e) 
   { 
      base.OnItemImageBorderStyleChanged(e); 
      Console.WriteLine("OnItemImageBorderStyleChanged is called"); 
   } 
 
   protected override void OnItemImageSizeChanged(EventArgs e) 
   { 
      base.OnItemImageSizeChanged(e); 
      Console.WriteLine("OnItemImageSizeChanged is called"); 
   } 
 
   protected override void OnItemSelectedBackColorChanged(EventArgs e) 
   { 
      base.OnItemSelectedBackColorChanged(e); 
      Console.WriteLine("OnItemSelectedBackColorChanged is called"); 
   } 
 
   protected override void OnItemSelectedForeColorChanged(EventArgs e) 
   { 
      base.OnItemSelectedForeColorChanged(e); 
      Console.WriteLine("OnItemSelectedForeColorChanged is called"); 
   } 
 
   protected override void OnItemSizeChanged(EventArgs e) 
   { 
      base.OnItemSizeChanged(e); 
      Console.WriteLine("OnItemSizeChanged is called"); 
   } 
 
   protected override void OnItemSpacingSizeChanged(EventArgs e) 
   { 
      base.OnItemSpacingSizeChanged(e); 
      Console.WriteLine("OnItemSpacingSizeChanged is called"); 
   } 
 
   protected override void OnKeyDown(KeyEventArgs e) 
   { 
      base.OnKeyDown(e); 
      Console.WriteLine("OnKeyDown is called"); 
   } 
 
   protected override void OnLostFocus(EventArgs e) 
   { 
      base.OnLostFocus(e); 
      Console.WriteLine("OnLostFocus is called"); 
   } 
 
   protected override void OnMouseDown(MouseEventArgs e) 
   { 
      base.OnMouseDown(e); 
      Console.WriteLine("OnMouseDown is called"); 
   } 
 
   protected override void OnMouseMove(MouseEventArgs e) 
   { 
      base.OnMouseMove(e); 
      Console.WriteLine("OnMouseMove is called"); 
   } 
 
   protected override void OnMouseUp(MouseEventArgs e) 
   { 
      base.OnMouseUp(e); 
      Console.WriteLine("OnMouseUp is called"); 
   } 
 
   protected override void OnPaint(PaintEventArgs e) 
   { 
      base.OnPaint(e); 
      Console.WriteLine("OnPaint is called"); 
   } 
 
   protected override void OnPaintPropertiesChanged(EventArgs e) 
   { 
      base.OnPaintPropertiesChanged(e); 
      Console.WriteLine("OnPaintPropertiesChanged is called"); 
   } 
 
   protected override void OnScroll(EventArgs e) 
   { 
      base.OnScroll(e); 
      Console.WriteLine("OnScroll is called"); 
   } 
 
   protected override void OnScrollStyleChanged(EventArgs e) 
   { 
      base.OnScrollStyleChanged(e); 
      Console.WriteLine("OnScrollStyleChanged is called"); 
   } 
 
   protected override void OnSelectedIndexChanged(EventArgs e) 
   { 
      base.OnSelectedIndexChanged(e); 
      Console.WriteLine("OnSelectedIndexChanged is called"); 
   } 
 
   protected override void OnSelectionModeChanged(EventArgs e) 
   { 
      base.OnSelectionModeChanged(e); 
      Console.WriteLine("OnSelectionModeChanged is called"); 
   } 
 
   protected override void OnSelectUserImageChanged(EventArgs e) 
   { 
      base.OnSelectUserImageChanged(e); 
      Console.WriteLine("OnSelectUserImageChanged is called"); 
   } 
 
   protected override void OnShowItemTextChanged(EventArgs e) 
   { 
      base.OnShowItemTextChanged(e); 
      Console.WriteLine("OnShowItemTextChanged is called"); 
   } 
 
   protected override void OnSizeChanged(EventArgs e) 
   { 
      base.OnSizeChanged(e); 
      Console.WriteLine("OnSizeChanged is called"); 
   } 
 
   protected override void OnSorterChanged(EventArgs e) 
   { 
      base.OnSorterChanged(e); 
      Console.WriteLine("OnSorterChanged is called"); 
   } 
 
   protected override void OnSortingChanged(EventArgs e) 
   { 
      base.OnSortingChanged(e); 
      Console.WriteLine("OnSortingChanged is called"); 
   } 
 
   protected override void OnViewStyleChanged(EventArgs e) 
   { 
      base.OnViewStyleChanged(e); 
      Console.WriteLine("OnViewStyleChanged is called"); 
   } 
}

Remarks

Raising an event invokes the event handler through a delegate.

The OnPaint 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 OnPaint in a derived class, be sure to call the base class's OnPaint method so that registered delegates receive the event.

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