A color object that defines the required color of the newly added ruler annotation. This value defines the color of the ruler's drawn line and it corresponds to the AnnotationRuler.StrokeColor property.
The width of the newly added ruler annotation, in inches. This value defines the width of the ruler's drawn line and it corresponds to the AnnotationRuler.BorderWidth property.
The opacity value of the newly added ruler annotation, from 0 (full transparency) to 1 (full opacity).
The measurement unit of the newly added ruler. The ruler presents its current length in the defined unit at the end of the drawn line.
Example





In This Topic
GdPicture14.WPF Namespace / GdViewer Class / AddRulerAnnotInteractive Method

AddRulerAnnotInteractive Method (GdViewer)

In This Topic
Allows users to interactively add a new 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 ruler annotation depicts a single drawn line showing its length.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeRuler. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationRuler 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 AddRulerAnnotInteractive( _
   ByVal BorderColor As Color, _
   ByVal BorderWidth As Single, _
   ByVal Opacity As Single, _
   ByVal MeasurementUnit As Annotation.UnitMode _
) 
public void AddRulerAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   float Opacity,
   Annotation.UnitMode MeasurementUnit
)
public procedure AddRulerAnnotInteractive( 
    BorderColor: Color;
    BorderWidth: Single;
    Opacity: Single;
    MeasurementUnit: Annotation.UnitMode
); 
public function AddRulerAnnotInteractive( 
   BorderColor : Color,
   BorderWidth : float,
   Opacity : float,
   MeasurementUnit : Annotation.UnitMode
);
public: void AddRulerAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   float Opacity,
   Annotation.UnitMode MeasurementUnit
) 
public:
void AddRulerAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   float Opacity,
   Annotation.UnitMode MeasurementUnit
) 

Parameters

BorderColor
A color object that defines the required color of the newly added ruler annotation. This value defines the color of the ruler's drawn line and it corresponds to the AnnotationRuler.StrokeColor property.
BorderWidth
The width of the newly added ruler annotation, in inches. This value defines the width of the ruler's drawn line and it corresponds to the AnnotationRuler.BorderWidth property.
Opacity
The opacity value of the newly added ruler annotation, from 0 (full transparency) to 1 (full opacity).
MeasurementUnit
The measurement unit of the newly added ruler. The ruler presents its current length in the defined unit at the end of the drawn line.
Remarks
The GetStat method can be subsequently used 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 buttonAddRuler_Click(ByVal sender As Object, ByVal e As EventArgs)
    GdViewer1.AddRulerAnnotInteractive(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(), "AddRulerAnnotInteractive")
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void buttonAddRuler_Click(object sender, EventArgs e)
{
    GdViewer1.AddRulerAnnotInteractive(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(), "AddRulerAnnotInteractive");
}
See Also