A color object that defines the required color of the newly added poly ruler annotation. It is the color of the ruler's drawn line and it corresponds to the AnnotationPolyRuler.StrokeColor property.
An array of points, in inches, which determines the poly ruler line segments.
The measurement unit of the newly added poly ruler. The poly ruler presents its current length in the defined unit at the end of the drawn line.
Example





In This Topic
GdPicture14 Namespace / AnnotationManager Class / AddPolyRulerAnnot Method

AddPolyRulerAnnot Method (AnnotationManager)

In This Topic
Adds a new GdPicture/XMP poly ruler annotation on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. A poly ruler annotation consists of several connected lines presenting its entire length in the specified measurement unit.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypePolyRuler. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationPolyRuler class right after the successful creation of the annotation object.

Be aware that annotations are always treated relative to the currently selected page.

Adds a new GdPicture/XMP poly ruler annotation on the selected page of the document currently handled by this AnnotationManager object.
Syntax
'Declaration
 
Public Function AddPolyRulerAnnot( _
   ByVal BorderColor As Color, _
   ByVal Points() As PointF, _
   ByVal MeasurementUnit As Annotation.UnitMode _
) As AnnotationPolyRuler
public AnnotationPolyRuler AddPolyRulerAnnot( 
   Color BorderColor,
   PointF[] Points,
   Annotation.UnitMode MeasurementUnit
)
public function AddPolyRulerAnnot( 
    BorderColor: Color;
    Points: PointFarray of;
    MeasurementUnit: Annotation.UnitMode
): AnnotationPolyRuler; 
public function AddPolyRulerAnnot( 
   BorderColor : Color,
   Points : PointF[],
   MeasurementUnit : Annotation.UnitMode
) : AnnotationPolyRuler;
public: AnnotationPolyRuler* AddPolyRulerAnnot( 
   Color BorderColor,
   PointF[]* Points,
   Annotation.UnitMode MeasurementUnit
) 
public:
AnnotationPolyRuler^ AddPolyRulerAnnot( 
   Color BorderColor,
   array<PointF>^ Points,
   Annotation.UnitMode MeasurementUnit
) 

Parameters

BorderColor
A color object that defines the required color of the newly added poly ruler annotation. It is the color of the ruler's drawn line and it corresponds to the AnnotationPolyRuler.StrokeColor property.
Points
An array of points, in inches, which determines the poly ruler line segments.
MeasurementUnit
The measurement unit of the newly added poly ruler. The poly ruler presents its current length in the defined unit at the end of the drawn line.

Return Value

A GdPicture/XMP AnnotationPolyRuler object. The newly added GdPicture/XMP poly ruler annotation.
Remarks
Please ensure that you have selected the proper page before starting any annotation related action with the handled document. Annotations are always treated relative to the currently selected page.

You can regularly apply the GetStat method to determine if this method has been successful.

Example
How to add a poly ruler annotation to a newly created image.
Dim status As GdPictureStatus = GdPictureStatus.OK
Using image As GdPictureImaging = New GdPictureImaging()
    Dim imageID As Integer = image.CreateNewGdPictureImage(1000, 1600, CShort(32), Color.White)
    status = image.GetStat()
    If (status = GdPictureStatus.OK) AndAlso (imageID <> 0) Then
        Using annotMgr As AnnotationManager = New AnnotationManager()
            If (annotMgr.InitFromGdPictureImage(imageID) = GdPictureStatus.OK) AndAlso
               (annotMgr.SelectPage(1) = GdPictureStatus.OK) Then
                Dim left As Single = 1, top As Single = 1, width As Single = 5, height As Single = 3
                Dim annotRect As GdPicture14.Annotations.AnnotationRectangle = annotMgr.AddRectangleAnnot(Color.SteelBlue, Color.LightBlue, left, top, width, height)
                If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annotRect IsNot Nothing) Then
                    annotRect.Author = "GdPicture"
                    annotRect.BorderWidth = 0.1F
                    annotRect.Opacity = 0.85F
                End If
                annotRect.Dispose()
                If annotMgr.BurnAnnotationsToPage(True) = GdPictureStatus.OK Then
                    Dim points As PointF() = New PointF(4) {New PointF(left, top), New PointF(left + width, top),
                                                            New PointF(left + width, top + height),
                                                            New PointF(left, top + height), New PointF(left, top)}
                    Dim annotPolyRuler As GdPicture14.Annotations.AnnotationPolyRuler = annotMgr.AddPolyRulerAnnot(Color.Blue, points, GdPicture14.Annotations.Annotation.UnitMode.Inch)
                    If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annotPolyRuler IsNot Nothing) Then
                        annotPolyRuler.Author = "GdPicture"
                        annotPolyRuler.BorderWidth = 0.02F
                        annotPolyRuler.FontSize = 14
                        annotPolyRuler.FontStyle = System.Drawing.FontStyle.Bold
                        annotPolyRuler.ForeColor = Color.Red
                        annotPolyRuler.Opacity = 1
                    End If
                    annotPolyRuler.Dispose()
                End If
                If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
                    annotMgr.SaveDocumentToJPEG("polyruler.jpeg", 75)
                End If
            End If
            status = annotMgr.GetStat()
            annotMgr.Close()
        End Using
        image.ReleaseGdPictureImage(imageID)
    End If
End Using
'We assume that the GdViewer1 control has been integrated into your application.
If status = GdPictureStatus.OK Then
    GdViewer1.DisplayFromFile("polyruler.jpeg")
Else
    MessageBox.Show("Error!   Status: " + status.ToString(), "AnnotationManager.AddPolyRulerAnnot")
End If
GdPictureStatus status = GdPictureStatus.OK;
using (GdPictureImaging image = new GdPictureImaging())
{
    int imageID = image.CreateNewGdPictureImage(1000, 1600, 32, Color.White);
    status = image.GetStat();
    if ((status == GdPictureStatus.OK) && (imageID != 0))
    {
        using (AnnotationManager annotMgr = new AnnotationManager())
        {
            if ((annotMgr.InitFromGdPictureImage(imageID) == GdPictureStatus.OK) &&
                (annotMgr.SelectPage(1) == GdPictureStatus.OK))
            {
                float left = 1, top = 1,  width = 5, height = 3;
                GdPicture14.Annotations.AnnotationRectangle annotRect = annotMgr.AddRectangleAnnot(Color.SteelBlue, Color.LightBlue, left, top, width, height);
                if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annotRect != null))
                {
                    annotRect.Author = "GdPicture";
                    annotRect.BorderWidth = 0.1f;
                    annotRect.Opacity = 0.85f;
                }
                annotRect.Dispose();
                if (annotMgr.BurnAnnotationsToPage(true) == GdPictureStatus.OK)
                {
                    PointF[] points = new PointF[5] { new PointF(left, top), new PointF(left + width, top),
                                                      new PointF(left + width, top + height),
                                                      new PointF(left, top + height), new PointF(left, top)};
            
                    GdPicture14.Annotations.AnnotationPolyRuler annotPolyRuler = annotMgr.AddPolyRulerAnnot(Color.Blue, points, GdPicture14.Annotations.Annotation.UnitMode.Inch);
                    if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annotPolyRuler != null))
                    {
                        annotPolyRuler.Author = "GdPicture";
                        annotPolyRuler.BorderWidth = 0.02f;
                        annotPolyRuler.FontSize = 14;
                        annotPolyRuler.FontStyle = System.Drawing.FontStyle.Bold;
                        annotPolyRuler.ForeColor = Color.Red;
                        annotPolyRuler.Opacity = 1;
                    }
                    annotPolyRuler.Dispose();
                }
                if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
                    annotMgr.SaveDocumentToJPEG("polyruler.jpeg", 75);
            }
            status = annotMgr.GetStat();
            annotMgr.Close();
        }
        image.ReleaseGdPictureImage(imageID);
    }
}
//We assume that the GdViewer1 control has been integrated into your application.
if (status == GdPictureStatus.OK)
    GdViewer1.DisplayFromFile("polyruler.jpeg");
else
    MessageBox.Show("Error!   Status: " + status.ToString(), "AnnotationManager.AddPolyRulerAnnot");
See Also