GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / AddRectangleAnnotInteractive Method
Set this parameter to true, if you want to fill the rectangle using the defined background color, otherwise set it to false.
Set this parameter to true, if you want to stroke the rectangle using the defined border color, otherwise set it to false.
A color object that defines the required background color of the newly added rectangle annotation.
A color object that defines the required border color of the newly added rectangle annotation.
The border width of the newly added rectangle annotation, in inches.
The opacity value of the newly added rectangle annotation, from 0 (full transparency) to 1 (full opacity).
Example





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

This annotation enables users to draw a filled and bordered rectangle or square by adjusting its height and width continuously using the mouse.

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

Parameters

Fill
Set this parameter to true, if you want to fill the rectangle using the defined background color, otherwise set it to false.
Stroke
Set this parameter to true, if you want to stroke the rectangle using the defined border color, otherwise set it to false.
BackColor
A color object that defines the required background color of the newly added rectangle annotation.
BorderColor
A color object that defines the required border color of the newly added rectangle annotation.
BorderWidth
The border width of the newly added rectangle annotation, in inches.
Opacity
The opacity value of the newly added rectangle 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 rectangle annotation on the currently displayed page.
'We assume that the GdViewer1 control has been properly integrated.
Sub buttonAddRectangle_Click(ByVal sender As Object, ByVal e As EventArgs)
    GdViewer1.AddRectangleAnnotInteractive(true, true, Color.Yellow, Color.CadetBlue, 0.05F, 0.65F)
    If GdViewer1.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddRectangleAnnotInteractive")
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void buttonAddRectangle_Click(object sender, EventArgs e)
{
    GdViewer1.AddRectangleAnnotInteractive(true, true, Color.Yellow, Color.CadetBlue, 0.05f, 0.65f);
    if (GdViewer1.GetStat() != GdPictureStatus.OK) MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddRectangleAnnotInteractive");
}
See Also