Reference Guide
GdPicture14.WPF Namespace / GdViewer Class / AddPolyRulerAnnotInteractive Method
A color object that defines the required color of the newly added poly ruler annotation. This value defines the color of the poly ruler's drawn lines and it corresponds to the AnnotationPolyRuler.StrokeColor property.
The width of the newly added poly ruler annotation, in inches. This value defines the width of the poly ruler's drawn lines and it corresponds to the AnnotationPolyRuler.BorderWidth property.
The opacity value of the newly added poly ruler annotation, from 0 (full transparency) to 1 (full opacity).
The measurement unit of the newly added poly ruler. The poly ruler presents its current length as the sum of the lengths of all connected lines in the defined unit at the end of the whole drawn line.
Example





In This Topic
    AddPolyRulerAnnotInteractive Method (GdViewer)
    In This Topic
    Allows users to interactively add a new poly ruler annotation using the mouse on the current page of the document displayed in the GdViewer control. The annotation object is added following all the parameters you have specified and respecting the dimensions users will define using the mouse as well.

    A poly ruler annotation consists of several connected lines presenting its entire length. Users end every individual line with a single click, and they finish the annotation with a double-click.

    The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypePolyRuler. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationPolyRuler class before or after the successful creation of the annotation object. Please refer to both the BeforeAnnotationAddedByUser and the AnnotationAddedByUser events, respectively to both the PreviewBeforeAnnotationAddedByUser and the PreviewAnnotationAddedByUser events, for how to achieve this.

    Be aware that the editing mode for annotations must be enabled using the SetAnnotationEditorMode method, otherwise this method will fail.

    Syntax
    'Declaration
     
    
    Public Sub AddPolyRulerAnnotInteractive( _
       ByVal BorderColor As Color, _
       ByVal BorderWidth As Single, _
       ByVal Opacity As Single, _
       ByVal MeasurementUnit As Annotation.UnitMode _
    ) 
    public void AddPolyRulerAnnotInteractive( 
       Color BorderColor,
       float BorderWidth,
       float Opacity,
       Annotation.UnitMode MeasurementUnit
    )
    public procedure AddPolyRulerAnnotInteractive( 
        BorderColor: Color;
        BorderWidth: Single;
        Opacity: Single;
        MeasurementUnit: Annotation.UnitMode
    ); 
    public function AddPolyRulerAnnotInteractive( 
       BorderColor : Color,
       BorderWidth : float,
       Opacity : float,
       MeasurementUnit : Annotation.UnitMode
    );
    public: void AddPolyRulerAnnotInteractive( 
       Color BorderColor,
       float BorderWidth,
       float Opacity,
       Annotation.UnitMode MeasurementUnit
    ) 
    public:
    void AddPolyRulerAnnotInteractive( 
       Color BorderColor,
       float BorderWidth,
       float Opacity,
       Annotation.UnitMode MeasurementUnit
    ) 

    Parameters

    BorderColor
    A color object that defines the required color of the newly added poly ruler annotation. This value defines the color of the poly ruler's drawn lines and it corresponds to the AnnotationPolyRuler.StrokeColor property.
    BorderWidth
    The width of the newly added poly ruler annotation, in inches. This value defines the width of the poly ruler's drawn lines and it corresponds to the AnnotationPolyRuler.BorderWidth property.
    Opacity
    The opacity value of the newly added poly ruler annotation, from 0 (full transparency) to 1 (full opacity).
    MeasurementUnit
    The measurement unit of the newly added poly ruler. The poly ruler presents its current length as the sum of the lengths of all connected lines in the defined unit at the end of the whole drawn line.
    Remarks
    Please always use the GetStat method to determine if this method has been successful. If the editing mode for annotations is disabled, the method will fail.
    Example
    How to allow users to interactively add ruler annotation on the currently displayed page.
    'We assume that the GdViewer1 control has been properly integrated.
    Sub buttonAddPolyRuler_Click(ByVal sender As Object, ByVal e As EventArgs)
        GdViewer1.AddPolyRulerAnnotInteractive(Color.FromArgb(255, 255, 0, 0), 0.03F, 0.75F, GdPicture14.Annotations.Annotation.UnitMode.Pixel)
        If GdViewer1.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddPolyRulerAnnotInteractive")
    End Sub
    //We assume that the GdViewer1 control has been properly integrated.
    void buttonAddPolyRuler_Click(object sender, EventArgs e)
    {
        GdViewer1.AddPolyRulerAnnotInteractive(Color.FromArgb(255, 255, 0, 0), 0.03f, 0.75f, GdPicture14.Annotations.Annotation.UnitMode.Pixel);
        if (GdViewer1.GetStat() != GdPictureStatus.OK) MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddPolyRulerAnnotInteractive");
    }
    See Also