InteractiveRegionRectangle Event

Summary

Occurs when the user performs interactive creation of a rectangular region for the image.

Syntax

C#
C++/CLI
C++
public event EventHandler<RasterViewerRectangleEventArgs> InteractiveRegionRectangle 
public: 
event EventHandler<RasterViewerRectangleEventArgs^>^ InteractiveRegionRectangle 
public:  
   event EventHandler<RasterViewerRectangleEventArgs^>^ InteractiveRegionRectangle 

Event Data

The event handler receives an argument of type RasterViewerRectangleEventArgs containing data related to this event. The following RasterViewerRectangleEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from Leadtools.WinForms.RasterViewerInteractiveEventArgs)Gets or sets a value indicating whether the interactive mode should be canceled.
Rectangle Returns the current interactive mode rectangle.
Status (Inherited from Leadtools.WinForms.RasterViewerInteractiveEventArgs)Gets the current status of the interactive mode.

Remarks

Only occurs when the InteractiveMode property is set to RasterViewerInteractiveMode.Region and the InteractiveRegionType is set to RasterViewerInteractiveRegionType.Rectangle.

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.