OnPaint Method

Summary

Overrides System.Windows.Forms.Control.OnPaint(System.Windows.Forms.PaintEventArgs).

Syntax

C#
C++/CLI
C++
protected override void OnPaint( 
   PaintEventArgs e 
) 
protected: 
void OnPaint(  
   PaintEventArgs^ e 
) override  
protected:  
   virtual void OnPaint( 
      PaintEventArgs^ e 
   ) override 

Parameters

e
A System.Windows.Forms.PaintEventArgs that contains information about the control to paint.

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.

Example

This example overrides the virtual events of the RasterImagePanViewer class.

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
 
public class MyRasterImagePanViewer : RasterImagePanViewer 
{ 
   //. 
   //. 
   //. 
   protected override void OnViewerChanged(EventArgs e) 
   { 
      base.OnViewerChanged(e); 
 
      Console.WriteLine("OnViewerChanged is called"); 
   } 
 
   protected override void OnRectangleColorChanged(EventArgs e) 
   { 
      base.OnRectangleColorChanged(e); 
 
      Console.WriteLine("OnRectangleColorChanged is called"); 
   } 
 
   protected override void OnImageColorChanged(EventArgs e) 
   { 
      base.OnImageColorChanged(e); 
 
      Console.WriteLine("OnImageColorChanged is called"); 
   } 
 
   protected override void OnClipCursorChanged(EventArgs e) 
   { 
      base.OnClipCursorChanged(e); 
 
      Console.WriteLine("OnClipCursorChanged is called"); 
   } 
 
   protected override void OnPaint(PaintEventArgs e) 
   { 
      base.OnPaint(e); 
 
      Console.WriteLine("OnPaint 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 OnLostFocus(EventArgs e) 
   { 
      base.OnLostFocus(e); 
 
      Console.WriteLine("OnLostFocus is called"); 
   } 
 
   protected override void OnSizeChanged(EventArgs e) 
   { 
      base.OnSizeChanged(e); 
 
      Console.WriteLine("OnSizeChanged is called"); 
   } 
} 

Requirements

Target Platforms

See Also

Reference

RasterImagePanViewer Class

RasterImagePanViewer Members

Help Version 22.0.2023.2.9
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.WinForms Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.