LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.31
AnnPolygonObject Class
See Also  Members  
Leadtools.Windows.Annotations Namespace : AnnPolygonObject Class



The AnnPolygonObject Class supports WPF/Silverlight.

The AnnPolygonObject Class is available in LEADTOOLS Document and Medical Imaging toolkits.

Defines an annotation polygon object. Supported in Silverlight, Windows Phone 7

Object Model

AnnPolygonObject Class

Syntax

Visual Basic (Declaration) 
Public Class AnnPolygonObject 
   Inherits AnnPolylineObject
   Implements IAnnHeaderIAnnObjectIAnnPolygonIAnnPolyline 
Visual Basic (Usage)Copy Code
Dim instance As AnnPolygonObject
C# 
public class AnnPolygonObject : AnnPolylineObject, IAnnHeaderIAnnObjectIAnnPolygonIAnnPolyline  
C++/CLI 
public ref class AnnPolygonObject : public AnnPolylineObject, IAnnHeaderIAnnObjectIAnnPolygonIAnnPolyline  

Example

This example creates a new closed polygon object with 4 points.

Visual BasicCopy Code
Private Sub AnnPolygonObject_AnnPolygonObject(ByVal container As AnnContainer)
   Dim polygon As AnnPolygonObject = New AnnPolygonObject()
   polygon.Points.Add(New System.Windows.Point(100, 100))
   polygon.Points.Add(New System.Windows.Point(200, 100))
   polygon.Points.Add(New System.Windows.Point(200, 200))
   polygon.Points.Add(New System.Windows.Point(100, 300))
   polygon.Stroke = Colors.Red
   polygon.StrokeThickness = 1.0
   polygon.Fill = Colors.White
   polygon.FillRule = AnnFillRule.EvenOdd
   polygon.IsClosed = True
   container.Children.Add(polygon)
End Sub
C#Copy Code
private void AnnPolygonObject_AnnPolygonObject(AnnContainer container)
{
   AnnPolygonObject polygon = new AnnPolygonObject();
   polygon.Points.Add(new Point(100, 100));
   polygon.Points.Add(new Point(200, 100));
   polygon.Points.Add(new Point(200, 200));
   polygon.Points.Add(new Point(100, 300));
   polygon.Stroke = Colors.Red;
   polygon.Fill = Colors.White;
   polygon.FillRule = AnnFillRule.EvenOdd;
   polygon.StrokeThickness = 1.0;
   polygon.IsClosed = true;
   container.Children.Add(polygon);
}
SilverlightCSharpCopy Code
private void AnnPolygonObject_AnnPolygonObject(AnnContainer container)
{
   AnnPolygonObject polygon = new AnnPolygonObject();
   polygon.Points.Add(new Point(100, 100));
   polygon.Points.Add(new Point(200, 100));
   polygon.Points.Add(new Point(200, 200));
   polygon.Points.Add(new Point(100, 300));
   polygon.Stroke = Colors.Red;
   polygon.Fill = Colors.White;
   polygon.FillRule = AnnFillRule.EvenOdd;
   polygon.StrokeThickness = 1.0;
   polygon.IsClosed = true;
   container.Children.Add(polygon);
}
SilverlightVBCopy Code
Private Sub AnnPolygonObject_AnnPolygonObject(ByVal container As AnnContainer)
   Dim polygon As AnnPolygonObject = New AnnPolygonObject()
   polygon.Points.Add(New Point(100, 100))
   polygon.Points.Add(New Point(200, 100))
   polygon.Points.Add(New Point(200, 200))
   polygon.Points.Add(New Point(100, 300))
   polygon.Stroke = Colors.Red
   polygon.Fill = Colors.White
   polygon.FillRule = AnnFillRule.EvenOdd
   polygon.StrokeThickness = 1.0
   polygon.IsClosed = True
   container.Children.Add(polygon)
End Sub
XAMLCopy Code
<Window x:Class="WPFSamples.AnnPolygonObject" Title="Leadtools.Windows.Annotations" 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_Annotations="clr-namespace:Leadtools.Windows.Annotations;assembly=Leadtools.Windows.Annotations">
  <Leadtools_Windows_Annotations:AnnContainer Width="400" Height="400" Background="Yellow">
    <Leadtools_Windows_Annotations:AnnPolygonObject Points="100,100 175, 125, 25,150 175,175 100,200" IsClosed="True" FillRule="EvenOdd" Fill="Green" Stroke="Blue" StrokeThickness="8.0" StrokeDashArray="1.5, 1.5" StrokeDashOffset="2.0" StrokeDashCap="Round" StrokeStartLineCap="Round" StrokeLineJoin="Round" StrokeEndLineCap="Round" StrokeMiterLimit="10" Header="Polygon Object" HeaderOffset="-10, -10" HeaderBackground="Red" HeaderForeground="Green" HeaderFontFamily="Agency FB" HeaderFontStyle="Italic" HeaderFontWeight="Bold" HeaderFontStretch="Normal" HeaderFontSize="20" HeaderDecorations="Strikethrough" IsHeaderVisible="True" IsHeaderRestricted="True"></Leadtools_Windows_Annotations:AnnPolygonObject>
  </Leadtools_Windows_Annotations:AnnContainer>
</Window>

Remarks

The polygon object is a simple polygon that contains a collection of System.Windows.Point points, a stroke and a fill. The polygon can be AnnPolygonObject.IsClosed or not, and can also have a certain AnnPolygonObject.FillRule. For an illustration of the different fill modes, refer to FillRule enumeration.

For more information about the polygon annotation object refer to AnnPolygonObject for WPF. For more information about the automated polygon annotation object, refer to WPF Annotation Objects - Automated Features.

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         Leadtools.Windows.Annotations.AnnObject
            Leadtools.Windows.Annotations.AnnPolylineObject
               Leadtools.Windows.Annotations.AnnPolygonObject
                  Leadtools.Windows.Annotations.AnnClosedCurveObject
                  Leadtools.Windows.Annotations.AnnFreehandHotspotObject

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also

AnnPolygonObject requires a Document/Medical product license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features and Unlocking Special LEAD Features.