Leadtools.WinForms Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
FloaterPosition Property
See Also  Example
Leadtools.WinForms Namespace > RasterImageViewer Class : FloaterPosition Property



Gets or sets the position of the floater.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Floater and Region")>
<DescriptionAttribute("Gets or sets the position of the floater.")>
Public Overridable Property FloaterPosition As Point
Visual Basic (Usage)Copy Code
Dim instance As RasterImageViewer
Dim value As Point
 
instance.FloaterPosition = value
 
value = instance.FloaterPosition
C# 
[CategoryAttribute("Floater and Region")]
[DescriptionAttribute("Gets or sets the position of the floater.")]
public virtual Point FloaterPosition {get; set;}
C++/CLI 
[CategoryAttribute("Floater and Region")]
[DescriptionAttribute("Gets or sets the position of the floater.")]
public:
virtual property Point FloaterPosition {
   Point get();
   void set (Point value);
}

Return Value

A Point object that represents the top-left position used when painting the RasterImageViewer.FloaterImage.

Example

This sample creates a floater and lets the user move it.

Visual BasicCopy Code
Private Sub viewer_InteractiveFloater(ByVal sender As Object, ByVal e As RasterViewerPointEventArgs)
    ' show information about the user interaction
    Dim viewer As RasterImageViewer = CType(IIf(TypeOf sender Is RasterImageViewer, sender, Nothing), RasterImageViewer)
    Console.WriteLine("Status: {0}, Canceled: {1}, Point: {2}, Floater Position: {3}", e.Status, e.Cancel, e.Point, viewer.FloaterPosition)
End Sub
Public Sub RasterImageViewer_FloaterPosition(ByVal viewer As RasterImageViewer)
    ' hook into the viewer InteractiveFloater event to get updated whenever the user moves the floater.
    AddHandler viewer.InteractiveFloater, AddressOf viewer_InteractiveFloater

    ' add a floater the viewer and start the floater interactive mode
    ' we are going to create the floater image manually as a red ellipse with a region.

    Dim palette As RasterColor() = New RasterColor() {}
    Dim floaterImage As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 200, 200, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, palette, IntPtr.Zero, 0)

    Dim container As RasterImageGdiPlusGraphicsContainer = floaterImage.CreateGdiPlusGraphics()
    Try
        container.Graphics.FillRectangle(Brushes.Black, 0, 0, floaterImage.ImageWidth, floaterImage.ImageHeight)
        container.Graphics.FillEllipse(Brushes.Red, 0, 0, floaterImage.ImageWidth, floaterImage.ImageHeight)
    Finally
        CType(container, IDisposable).Dispose()
    End Try

    floaterImage.AddColorToRegion(New RasterColor(Color.Red), RasterRegionCombineMode.Set)

    viewer.FloaterImage = floaterImage
    viewer.FloaterVisible = True
    viewer.FloaterPosition = New Point(100, 100)
    viewer.InteractiveMode = RasterViewerInteractiveMode.Floater

    MessageBox.Show("Click and move the floater")
End Sub
C#Copy Code
private void viewer_InteractiveFloater(object sender, RasterViewerPointEventArgs e) 

   // show information about the user interaction 
   RasterImageViewer viewer = sender as RasterImageViewer; 
   Console.WriteLine("Status: {0}, Canceled: {1}, Point: {2}, Floater Position: {3}", e.Status, e.Cancel, e.Point, viewer.FloaterPosition); 

public void RasterImageViewer_FloaterPosition(RasterImageViewer viewer) 

   // hook into the viewer InteractiveFloater event to get updated whenever the user moves the floater. 
   viewer.InteractiveFloater += new EventHandler<RasterViewerPointEventArgs>(viewer_InteractiveFloater); 
 
   // add a floater the viewer and start the floater interactive mode 
   // we are going to create the floater image manually as a red ellipse with a region. 
 
   RasterColor[]palette = new RasterColor[0]; 
   RasterImage floaterImage = new RasterImage( 
      RasterMemoryFlags.Conventional, 
      200, 
      200, 
      24, 
      RasterByteOrder.Bgr, 
      RasterViewPerspective.TopLeft, 
      palette, 
      IntPtr.Zero, 
      0 
      ); 
 
   using (RasterImageGdiPlusGraphicsContainer container = floaterImage.CreateGdiPlusGraphics()) 
   { 
      container.Graphics.FillRectangle(Brushes.Black, 0, 0, floaterImage.ImageWidth, floaterImage.ImageHeight); 
      container.Graphics.FillEllipse(Brushes.Red, 0, 0, floaterImage.ImageWidth, floaterImage.ImageHeight); 
   } 
 
   floaterImage.AddColorToRegion(new RasterColor(Color.Red), RasterRegionCombineMode.Set); 
 
   viewer.FloaterImage = floaterImage; 
   viewer.FloaterVisible = true; 
   viewer.FloaterPosition = new Point(100, 100); 
   viewer.InteractiveMode = RasterViewerInteractiveMode.Floater; 
 
   MessageBox.Show("Click and move the floater"); 
}

Remarks

You can manually set the value of this property to control where the RasterImageViewer.FloaterImage is painted.

When the RasterImageViewer.InteractiveMode of this RasterImageVieweris set to RasterViewerInteractiveMode.Floater, the viewer will update the value of this property as the user drags the RasterImageViewer.FloaterImage around.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also