GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / AddPolygonAnnotInteractive Method
A color object that defines the required border color of the newly added polygon annotation.
The border width of the newly added polygon annotation, in inches.
A color object that defines the required background color of the newly added polygon annotation.
The opacity value of the newly added polygon annotation, from 0 (full transparency) to 1 (full opacity).
Example





In This Topic
AddPolygonAnnotInteractive Method (GdViewer)
In This Topic
Allows users to interactively add a new polygon 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.

Users start drawing a polygon with a single line. Each single click adds a new polygon vertice. To finish the polygon they use a double-click.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypePolygon. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationPolygon 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 polygon annotation using the mouse on the current page of the document displayed in the GdViewer control.
Syntax
'Declaration
 
Public Sub AddPolygonAnnotInteractive( _
   ByVal BorderColor As Color, _
   ByVal BorderWidth As Single, _
   ByVal BackColor As Color, _
   ByVal Opacity As Single _
) 
public void AddPolygonAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   Color BackColor,
   float Opacity
)
public procedure AddPolygonAnnotInteractive( 
    BorderColor: Color;
    BorderWidth: Single;
    BackColor: Color;
    Opacity: Single
); 
public function AddPolygonAnnotInteractive( 
   BorderColor : Color,
   BorderWidth : float,
   BackColor : Color,
   Opacity : float
);
public: void AddPolygonAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   Color BackColor,
   float Opacity
) 
public:
void AddPolygonAnnotInteractive( 
   Color BorderColor,
   float BorderWidth,
   Color BackColor,
   float Opacity
) 

Parameters

BorderColor
A color object that defines the required border color of the newly added polygon annotation.
BorderWidth
The border width of the newly added polygon annotation, in inches.
BackColor
A color object that defines the required background color of the newly added polygon annotation.
Opacity
The opacity value of the newly added polygon annotation, from 0 (full transparency) to 1 (full opacity).
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 polygon annotation on the currently displayed page.
'We assume that the GdViewer1 control has been properly integrated.
Sub buttonAddPolygon_Click(ByVal sender As Object, ByVal e As EventArgs)
    GdViewer1.AddPolygonAnnotInteractive(Color.Blue, 0.05F, Color.Yellow, 1)
    If GdViewer1.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddPolygonAnnotInteractive")
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void buttonAddPolygon_Click(object sender, EventArgs e)
{
    GdViewer1.AddPolygonAnnotInteractive(Color.Blue, 0.05f, Color.Yellow, 1);
    if (GdViewer1.GetStat() != GdPictureStatus.OK) MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddPolygonAnnotInteractive");
}
See Also