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 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.
Allows users to interactively add a new ruler annotation using the mouse on the current page of the document displayed in the GdViewer control.
Syntax
'Declaration
Public Sub AddRulerAnnotInteractive( _
ByVal As Color, _
ByVal As Single, _
ByVal As Single, _
ByVal As Annotation.UnitMode _
)
public void AddRulerAnnotInteractive(
Color ,
float ,
float ,
Annotation.UnitMode
)
public procedure AddRulerAnnotInteractive(
: Color;
: Single;
: Single;
: Annotation.UnitMode
);
public function AddRulerAnnotInteractive(
: Color,
: float,
: float,
: Annotation.UnitMode
);
public: void AddRulerAnnotInteractive(
Color ,
float ,
float ,
Annotation.UnitMode
)
public:
void AddRulerAnnotInteractive(
Color ,
float ,
float ,
Annotation.UnitMode
)
Parameters
- BorderColor
- A color object that defines the required color of the newly added ruler annotation.
It is the color of the ruler's drawn line and it corresponds to the AnnotationRuler.StrokeColor property.
- BorderWidth
- The width of newly added ruler annotation, in inches. It is 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.
Example
How to allow users to interactively add a 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.Red, 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.Red, 0.03f, 0.75f, GdPicture14.Annotations.Annotation.UnitMode.Pixel);
if (GdViewer1.GetStat() != GdPictureStatus.OK) MessageBox.Show("Error! Status: " + GdViewer1.GetStat().ToString(), "AddRulerAnnotInteractive");
}
Example
How to allow users to interactively add a 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.Red, 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.Red, 0.03f, 0.75f, GdPicture14.Annotations.Annotation.UnitMode.Pixel);
if (GdViewer1.GetStat() != GdPictureStatus.OK) MessageBox.Show("Error! Status: " + GdViewer1.GetStat().ToString(), "AddRulerAnnotInteractive");
}
See Also