RegionToFloater Method

Summary

Converts the image region to a floater.

Syntax

C#
C++/CLI
C++
public virtual void RegionToFloater() 
public: 
virtual void RegionToFloater();  
public:  
   virtual void RegionToFloater() 

Remarks

Call this method to convert the current region inside Image to a floater. The FloaterPosition is automatically updated after you call this method.

This method will not delete the region from Image. If you need to do that, call Leadtools.RasterImage.MakeRegionEmpty after you call this method.

If the Image inside this RasterImageViewer does not have a region, this method will do nothing.

This method uses the Leadtools.ImageProcessing.CopyRectangleCommand image processing command to convert the image region to a floater image.

Example

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Drawing; 
 
private void viewer_FloaterInteractiveModeEnded(object sender, EventArgs e) 
{ 
   // an interactive mode is done.  check if its drawing a region 
   // if so, convert the region to a floater and set the interactive 
   // mode so that we can drag the floater 
   RasterImageViewer viewer = sender as RasterImageViewer; 
   if (viewer.InteractiveMode == RasterViewerInteractiveMode.Region) 
   { 
      viewer.EnableTimer = true; 
      viewer.RegionToFloater(); 
      viewer.FloaterVisible = true; 
      viewer.AnimateFloater = true; 
      viewer.InteractiveMode = RasterViewerInteractiveMode.Floater; 
 
      // delete the region since we do not need it anymore 
      viewer.Image.MakeRegionEmpty(); 
 
      MessageBox.Show("Move the floater around, double click anywhere on the viewer to combine it with the image"); 
   } 
} 
 
private void viewer_DoubleClick(object sender, EventArgs e) 
{ 
   // check if the interactive mode is Floater, if so,  
   // combine the floater with the image. 
   RasterImageViewer viewer = sender as RasterImageViewer; 
   if (viewer.InteractiveMode == RasterViewerInteractiveMode.Floater) 
   { 
      viewer.InteractiveMode = RasterViewerInteractiveMode.None; 
      viewer.CombineFloater(true, ImageProcessing.CombineFastCommandFlags.SourceCopy); 
 
      // get rid of the floater since we do not need it anymore 
      viewer.FloaterImage = null; 
      MessageBox.Show("The floater has been combined with the image"); 
   } 
} 
 
public void RasterImageViewer_FloaterImage(RasterImageViewer viewer) 
{ 
   // hook into the viewer InteractiveModeEnded and DoubleClick events 
   viewer.InteractiveModeEnded += new EventHandler(viewer_FloaterInteractiveModeEnded); 
   viewer.DoubleClick += new EventHandler(viewer_DoubleClick); 
 
   // first set the interactive mode to draw a freehand region 
   viewer.InteractiveRegionType = RasterViewerInteractiveRegionType.Freehand; 
   viewer.InteractiveRegionCombineMode = RasterRegionCombineMode.Set; 
   viewer.InteractiveMode = RasterViewerInteractiveMode.Region; 
 
   MessageBox.Show("Draw a freehand region on the image"); 
 
} 

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.