←Select platform

Floater Property

Summary

Floater image of this item.

Syntax
C#
VB
C++
public RasterImage Floater { get; set; } 
Public Property Floater() As RasterImage 
   Get 
   Set 
public:  
   property RasterImage^ Floater 
   { 
      RasterImage^ get() 
      void set(RasterImage^ value) 
   } 

Property Value

The floater image of this item. Default value is null.

Remarks

The image viewer supports a floater image that can be dragged with the mouse or touch when ImageViewerFloaterInteractiveMode is used.

The floater outline can be rendered or animated using FloaterRegionRenderMode.

The position, scale and rotation of the floater can be manipulated with the FloaterTransform property.

FloaterOpacity can be used to set any opacity value for the floater from completely transparent to fully opaque and in between.

Changing the value of this property will fire the ItemChanged event with ImageViewerItemChangedReason.Floater.

The viewer will subscribe to RasterImage.Changed and automatically perform the necessary updates when the floater image changes externally by other parts of the application.

Floater property of ImageViewer will update this member if this is the active item when the viewer is used in single item mode.

For more information, refer to Image Viewer Items.

Example
C#
VB
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using LeadtoolsExamples.Common; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
public void ImageViewerFloater_Example() 
{ 
   ImageViewerItem item = null; 
   RasterImage image = null; 
 
   if (_imageViewer.Items.Count > 0) 
   { 
      item = _imageViewer.Items[0]; 
      image = item.Image; 
   } 
 
   if (image == null) 
   { 
      if (item == null) 
         item = _imageViewer.Items.AddFromImage(RasterImage.Create(400, 400, 24, 96, RasterColor.White), 1); 
      else 
         item.Image = RasterImage.Create(400, 400, 24, 96, RasterColor.White); 
   } 
 
   var xForm = RasterRegionXForm.Default; 
   image.AddRectangleToRegion(xForm, new LeadRect(10, 10, 400, 200), RasterRegionCombineMode.Set); 
 
   xForm = RasterRegionXForm.Default; 
   xForm.ViewPerspective = image.ViewPerspective; 
   var rc = image.GetRegionBounds(xForm); 
   var command = new CopyRectangleCommand(rc, RasterMemoryFlags.Conventional); 
   command.Run(image); 
 
   var floater = command.DestinationImage; 
 
   rc = image.RectangleFromImage(RasterViewPerspective.TopLeft, rc); 
 
   if (floater != null) 
   { 
      xForm.ViewPerspective = RasterViewPerspective.TopLeft; 
      xForm.ViewPerspective = RasterViewPerspective.TopLeft; 
      xForm.XOffset = -rc.Left; 
      xForm.YOffset = -rc.Top; 
   } 
 
   image.MakeRegionEmpty(); 
   floater.MakeRegionEmpty(); 
 
   item.Floater = floater; 
   var transform = item.FloaterTransform; 
   transform.RotateAt(45, floater.ImageWidth / 2, floater.ImageHeight / 2); 
 
   item.FloaterTransform = transform; 
} 
Imports Leadtools 
Imports Leadtools.Controls 
Imports Leadtools.Codecs 
Imports Leadtools.Drawing 
Imports Leadtools.ImageProcessing 
Imports Leadtools.ImageProcessing.Color 
Imports LeadtoolsControlsExamples.LeadtoolsExamples.Common 
 
Public Sub ImageViewerFloater_Example() 
   Dim item As ImageViewerItem = Nothing 
   Dim image As RasterImage = Nothing 
 
   If _imageViewer.Items.Count > 0 Then 
      item = _imageViewer.Items(0) 
      image = item.Image 
   End If 
 
   If image Is Nothing Then 
      If item Is Nothing Then 
         item = _imageViewer.Items.AddFromImage(RasterImage.Create(400, 400, 24, 96, RasterColor.White), 1) 
      Else 
         item.Image = RasterImage.Create(400, 400, 24, 96, RasterColor.White) 
      End If 
   End If 
 
   Dim xForm As RasterRegionXForm = RasterRegionXForm.Default 
   image.AddRectangleToRegion(xForm, New LeadRect(10, 10, 400, 200), RasterRegionCombineMode.Set) 
 
   xForm = RasterRegionXForm.Default 
   xForm.ViewPerspective = image.ViewPerspective 
   Dim rc As LeadRect = image.GetRegionBounds(xForm) 
   Dim command As New CopyRectangleCommand(rc, RasterMemoryFlags.Conventional) 
   command.Run(image) 
 
   Dim floater As RasterImage = command.DestinationImage 
 
   rc = image.RectangleFromImage(RasterViewPerspective.TopLeft, rc) 
 
   If Not floater Is Nothing Then 
      xForm.ViewPerspective = RasterViewPerspective.TopLeft 
      xForm.ViewPerspective = RasterViewPerspective.TopLeft 
      xForm.XOffset = -rc.Left 
      xForm.YOffset = -rc.Top 
   End If 
 
   image.MakeRegionEmpty() 
   floater.MakeRegionEmpty() 
 
   item.Floater = floater 
   Dim transform As LeadMatrix = item.FloaterTransform 
   transform.RotateAt(45, floater.ImageWidth / 2, floater.ImageHeight / 2) 
 
   item.FloaterTransform = transform 
End Sub 

Requirements

Target Platforms

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

Leadtools.Controls Assembly