GdPicture.NET.14
GdPicture14.WPF Namespace / GdViewer Class / AddFreeHandAnnotInteractive Method / AddFreeHandAnnotInteractive(Color,Single,PenLineCap,PenLineCap,Single,Boolean) Method
A color object that defines the required color of the newly added freehand annotation. It corresponds to the AnnotationFreeHand.StrokeColor property.
The width of the newly added freehand annotation, in inches. It corresponds to the AnnotationFreeHand.BorderWidth property.
A member of the PenLineCap enumeration. Specifies the cap style used at the beginning of a drawn freehand line.
A member of the PenLineCap enumeration. Specifies the cap style used at the end of a drawn freehand line.
The opacity value of the newly added freehand annotation, from 0 (full transparency) to 1 (full opacity).
Set this parameter to true to enable the creation of multiple paths during one drawing operation. The individual annotation will be ended on the first double-click operation.

Set it to false to only enable the creation of one single freehand annotation.

Example





In This Topic
AddFreeHandAnnotInteractive(Color,Single,PenLineCap,PenLineCap,Single,Boolean) Method
In This Topic
Allows users to interactively add a new freehand 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 freehand annotation is an arbitrary line, which users draw by moving the mouse, with specified cap styles on its ending points. This method enables users to draw multiple separated freehand lines within one freehand annotation.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeFreeHand. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationFreeHand 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 Overloads Sub AddFreeHandAnnotInteractive( _
   ByVal BorderColor As Color, _
   ByVal BorderWidth As Single, _
   ByVal StartCap As PenLineCap, _
   ByVal EndCap As PenLineCap, _
   ByVal Opacity As Single, _
   ByVal ContinuousMode As Boolean _
) 
public void AddFreeHandAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   PenLineCap StartCap,
   PenLineCap EndCap,
   float Opacity,
   bool ContinuousMode
)
public procedure AddFreeHandAnnotInteractive( 
    BorderColor: Color;
    BorderWidth: Single;
    StartCap: PenLineCap;
    EndCap: PenLineCap;
    Opacity: Single;
    ContinuousMode: Boolean
); 
public function AddFreeHandAnnotInteractive( 
   BorderColor : Color,
   BorderWidth : float,
   StartCap : PenLineCap,
   EndCap : PenLineCap,
   Opacity : float,
   ContinuousMode : boolean
);
public: void AddFreeHandAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   PenLineCap StartCap,
   PenLineCap EndCap,
   float Opacity,
   bool ContinuousMode
) 
public:
void AddFreeHandAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   PenLineCap StartCap,
   PenLineCap EndCap,
   float Opacity,
   bool ContinuousMode
) 

Parameters

BorderColor
A color object that defines the required color of the newly added freehand annotation. It corresponds to the AnnotationFreeHand.StrokeColor property.
BorderWidth
The width of the newly added freehand annotation, in inches. It corresponds to the AnnotationFreeHand.BorderWidth property.
StartCap
A member of the PenLineCap enumeration. Specifies the cap style used at the beginning of a drawn freehand line.
EndCap
A member of the PenLineCap enumeration. Specifies the cap style used at the end of a drawn freehand line.
Opacity
The opacity value of the newly added freehand annotation, from 0 (full transparency) to 1 (full opacity).
ContinuousMode
Set this parameter to true to enable the creation of multiple paths during one drawing operation. The individual annotation will be ended on the first double-click operation.

Set it to false to only enable the creation of one single freehand annotation.

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 a freehand annotation on the currently displayed page.
'We assume that the GdViewer1 control has been properly integrated.
Sub buttonAddFreeHand_Click(ByVal sender As Object, ByVal e As EventArgs)
    GdViewer1.AddFreeHandAnnotInteractive(Color.FromArgb(255, 138, 43, 226), 0.1F, System.Windows.Media.PenLineCap.Triangle, System.Windows.Media.PenLineCap.Triangle, 1, True)
    If GdViewer1.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddFreeHandAnnotInteractive")
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void buttonAddFreeHand_Click(object sender, EventArgs e)
{
    GdViewer1.AddFreeHandAnnotInteractive(Color.FromArgb(255, 138, 43, 226), 0.1f, System.Windows.Media.PenLineCap.Triangle, System.Windows.Media.PenLineCap.Triangle, 1, true);
    if (GdViewer1.GetStat() != GdPictureStatus.OK) MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddFreeHandAnnotInteractive");
}
See Also