AddRectangleAnnotInteractive Method (GdViewer)
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 GdViewer.BeforeAnnotationAddedByUser and the GdViewer.AnnotationAddedByUser events for how to achieve this.
Be aware that the editing mode for annotations must be enabled using the GdViewer.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.
public void AddRectangleAnnotInteractive(
bool ,
bool ,
Color ,
Color ,
float ,
float
)
public procedure AddRectangleAnnotInteractive(
: Boolean;
: Boolean;
: Color;
: Color;
: Single;
: Single
);
public function AddRectangleAnnotInteractive(
: boolean,
: boolean,
: Color,
: Color,
: float,
: float
);
public: void AddRectangleAnnotInteractive(
bool ,
bool ,
Color ,
Color ,
float ,
float
)
public:
void AddRectangleAnnotInteractive(
bool ,
bool ,
Color ,
Color ,
float ,
float
)
'Declaration
Public Sub AddRectangleAnnotInteractive( _
ByVal As Boolean, _
ByVal As Boolean, _
ByVal As Color, _
ByVal As Color, _
ByVal As Single, _
ByVal As Single _
)
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).
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");
}