LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
GeometryFrameType Property
See Also 
Leadtools.Windows.Controls Namespace > ImageViewer Class : GeometryFrameType Property



Gets or sets a value indicating the current geometry frame type.

Syntax

Visual Basic (Declaration) 
Public Property GeometryFrameType As GeometryFrameType
Visual Basic (Usage)Copy Code
Dim instance As ImageViewer
Dim value As GeometryFrameType
 
instance.GeometryFrameType = value
 
value = instance.GeometryFrameType
C# 
public GeometryFrameType GeometryFrameType {get; set;}
C++/CLI 
public:
property GeometryFrameType GeometryFrameType {
   GeometryFrameType get();
   void set (    GeometryFrameType value);
}

Property Value

One of the GeometryFrameType enumeration members that indicate the current geometry frame type. Default value is GeometryFrameType.None.

Example

Visual BasicCopy Code
Private Shared Sub GeometryFrameTypeExample(ByVal viewer As RasterImageViewer)
      ' Clean any geometry and set the frame type to none
      ' These are the default values
      viewer.Geometry = Nothing
      viewer.GeometryFrameType = GeometryFrameType.None
      ' Load an image into the viewer
      Using codecs As New RasterCodecs()
         viewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"))
      End Using

      ' Set a region in the image
      Dim rc As New LeadRect(10, 10, viewer.Image.Width \ 3, viewer.Image.Height \ 3)
      viewer.Image.AddRectangleToRegion(Nothing, rc, RasterRegionCombineMode.Set)

      ' By default it is not visible
      MessageBox.Show("Frame: " + viewer.GeometryFrameType.ToString())

      ' Set it to fixed
      viewer.GeometryFrameType = GeometryFrameType.Fixed
      MessageBox.Show("Frame: " + viewer.GeometryFrameType.ToString())

      ' Finally, set it to animated
      viewer.GeometryFrameType = GeometryFrameType.Animated
      MessageBox.Show("Frame: " + viewer.GeometryFrameType.ToString())
   End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
C#Copy Code
private static void GeometryFrameTypeExample(RasterImageViewer viewer)
   {
      // Clean any geometry and set the frame type to none
      // These are the default values
      viewer.Geometry = null;
      viewer.GeometryFrameType = GeometryFrameType.None;
      // Load an image into the viewer
      using(RasterCodecs codecs = new RasterCodecs())
      {
         viewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"));
      }

      // Set a region in the image
      LeadRect rc = new LeadRect(10, 10, viewer.Image.Width / 3, viewer.Image.Height / 3);
      viewer.Image.AddRectangleToRegion(null, rc, RasterRegionCombineMode.Set);

      // By default it is not visible
      MessageBox.Show("Frame: " + viewer.GeometryFrameType.ToString());

      // Set it to fixed
      viewer.GeometryFrameType = GeometryFrameType.Fixed;
      MessageBox.Show("Frame: " + viewer.GeometryFrameType.ToString());

      // Finally, set it to animated
      viewer.GeometryFrameType = GeometryFrameType.Animated;
      MessageBox.Show("Frame: " + viewer.GeometryFrameType.ToString());
   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
SilverlightCSharpCopy Code
SilverlightVBCopy Code
XAMLCopy Code
<Window x:Class="WPFSamples.RasterImageViewer" Height="600" Width="800" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls">
  <DockPanel>
    <Leadtools_Windows_Controls:RasterImageViewer Name="theViewer" Image="file:///c:\users\Public\Documents\LEADTOOLS Images\Image1.cmp" DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Bottom" UseDpi="false" GeometryFrameType="Animated" />
  </DockPanel>
  <Window.Title>
        "GeometryFrameType"
      </Window.Title>
</Window>

Remarks

The ImageViewer.Geometry property can be used to put any shape on top of this control and frame it to indicate the current region of interest area.

The coordinates of the ImageViewer.Geometry must be in image coordinates, and accordingly, the geometry will be zoomed in and out and scrolled depending on current viewer zoom value and scroll position.

The ImageViewer control does not create a geometry object by itself, however you can set the value of ImageViewer.Geometry to any System.Windows.Media.Geometry object or one of its derived classes (for example, a System.Windows.Media.PathGeometry) to simulate a region of interest. How the coordinates are calculated and what to do with this area is up to you since WPF/Silverlight System.Windows.Media.ImageSource and its derived classes do not use a region of interest.

The RasterImageViewer control is used to view a LEADTOOLS Leadtools.RasterImage object. This object has support for a region of interest that can be used to limit image processing effects to a certain area of the image of example. The Leadtools.RasterImage region is expressed with a Leadtools.RasterRegion object and you can use the RasterRegionConverter.ConvertToGeometry to convert the Leadtools.RasterRegion object to a WPF/Silverlight System.Windows.Media.Geometry object. When the region inside the Leadtools.RasterImage object being used with this RasterImageViewer is changed, the control will automatically creates a new System.Windows.Media.Geometry object and set in the ImageViewer.Geometry property.

In either cases, to draw the geometry of the viewer, you must set the value of the ImageViewer.GeometryFrameType property to GeometryFrameType.Fixed or GeometryFrameType.Animated. This value is set to GeometryFrameType.None by default which instructs the control to not draw the geometry.

Requirements

Target Platforms: Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also