OnInteractiveRegionRectangle Method

Summary

Raises the InteractiveRegionRectangle event.

Syntax

C#
C++/CLI
C++
protected virtual void OnInteractiveRegionRectangle( 
   RasterViewerRectangleEventArgs e 
) 
protected: 
virtual void OnInteractiveRegionRectangle(  
   RasterViewerRectangleEventArgs^ e 
)  
protected:  
   virtual void OnInteractiveRegionRectangle( 
      RasterViewerRectangleEventArgs^ e 
   ) 

Parameters

e
A RasterViewerRectangleEventArgs that contains the event data.

Remarks

Raising an event invokes the event handler through a delegate. The OnInteractiveRegionRectangle 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 OnInteractiveRegionRectangle in a derived class, be sure to call the base class's OnInteractiveRegionRectangle method so that registered delegates receive the event.

Example

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Drawing; 
 
private void MyRasterViewerRectangleEventHandler(object sender, RasterViewerRectangleEventArgs e) 
{ 
   RasterImageViewer viewer = sender as RasterImageViewer; 
 
   RasterViewerRectangleEventArgs ee = new RasterViewerRectangleEventArgs(e.Status, e.Rectangle); 
   if (((e.Rectangle.Left > e.Rectangle.Right) || (e.Rectangle.Top > e.Rectangle.Bottom)) && e.Status == RasterViewerInteractiveStatus.End) 
   { 
      e.Cancel = true; 
      viewer.Invalidate(); 
      if (!viewer.IsInteractiveModeBusy) 
      { 
         MessageBox.Show("Interactive mode (Rectangular region) cancelled"); 
         viewer.InteractiveMode = RasterViewerInteractiveMode.None; 
      } 
   } 
   Console.WriteLine(@"" + e.Rectangle.Left + ", " + e.Rectangle.Top + ", " + e.Rectangle.Right + ", " + e.Rectangle.Bottom); 
} 
 
public void RasterImageViewer_IsInteractiveModeBusy(RasterImageViewer viewer) 
{ 
   viewer.InteractiveRegionRectangle += new EventHandler<RasterViewerRectangleEventArgs>(MyRasterViewerRectangleEventHandler); 
   viewer.InteractiveMode = RasterViewerInteractiveMode.Region; 
   viewer.InteractiveRegionType = RasterViewerInteractiveRegionType.Rectangle; 
 
   MessageBox.Show("Interactive mode set to draw a rectangular region.\nIf mouse is dragged up or to the left, interactive mode is cancelled"); 
} 

Requirements

Target Platforms

See Also

Reference

RasterImageViewer Class

RasterImageViewer 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.