GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / AddEmbeddedImageAnnotInteractive Method / AddEmbeddedImageAnnotInteractive(String,Boolean,Color,Single,Single) Method
The file path of the image resource to render as an annotation. Use the empty string to allow the control to prompt users to select a file.

You can subsequently use the GetLastPath method to retrieve the path of the selected file.

Set this parameter to true, if you want to stroke the embedded image using the defined border color, otherwise set it to false.
A color object that defines the required border color of the newly added embedded image annotation. It is the color of the border drawn around the embedded image if you set the Stroke parameter to true.
The border width of the newly added embedded image annotation, in inches. It is the width of the colored border drawn around the embedded image if you set the Stroke parameter to true.
The opacity value of the newly added embedded image annotation, from 0 (full transparency) to 1 (full opacity).
Example





In This Topic
AddEmbeddedImageAnnotInteractive(String,Boolean,Color,Single,Single) Method
In This Topic
Allows users to interactively add a new embedded image 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 embed a specified image on the page using its file path.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeEmbeddedImage. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationEmbeddedImage 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.

Syntax
'Declaration
 
Public Overloads Sub AddEmbeddedImageAnnotInteractive( _
   ByVal ImagePath As String, _
   ByVal Stroke As Boolean, _
   ByVal BorderColor As Color, _
   ByVal BorderWidth As Single, _
   ByVal Opacity As Single _
) 
public void AddEmbeddedImageAnnotInteractive( 
   string ImagePath,
   bool Stroke,
   Color BorderColor,
   float BorderWidth,
   float Opacity
)
public procedure AddEmbeddedImageAnnotInteractive( 
    ImagePath: String;
    Stroke: Boolean;
    BorderColor: Color;
    BorderWidth: Single;
    Opacity: Single
); 
public function AddEmbeddedImageAnnotInteractive( 
   ImagePath : String,
   Stroke : boolean,
   BorderColor : Color,
   BorderWidth : float,
   Opacity : float
);
public: void AddEmbeddedImageAnnotInteractive( 
   string* ImagePath,
   bool Stroke,
   Color BorderColor,
   float BorderWidth,
   float Opacity
) 
public:
void AddEmbeddedImageAnnotInteractive( 
   String^ ImagePath,
   bool Stroke,
   Color BorderColor,
   float BorderWidth,
   float Opacity
) 

Parameters

ImagePath
The file path of the image resource to render as an annotation. Use the empty string to allow the control to prompt users to select a file.

You can subsequently use the GetLastPath method to retrieve the path of the selected file.

Stroke
Set this parameter to true, if you want to stroke the embedded image using the defined border color, otherwise set it to false.
BorderColor
A color object that defines the required border color of the newly added embedded image annotation. It is the color of the border drawn around the embedded image if you set the Stroke parameter to true.
BorderWidth
The border width of the newly added embedded image annotation, in inches. It is the width of the colored border drawn around the embedded image if you set the Stroke parameter to true.
Opacity
The opacity value of the newly added embedded image 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.

Just to remind you, that this method changes the last path used by the current GdViewer control to the file path of the specified image.

Example
How to allow users to interactively add an embedded image annotation on the currently displayed page.
'We assume that the GdViewer1 control has been properly integrated.
Sub buttonAddImageAnnot_Click(ByVal sender As Object, ByVal e As EventArgs)
    GdViewer1.AddEmbeddedImageAnnotInteractive("", False, Color.Empty, 0, 1)
    If GdViewer1.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddEmbeddedImageAnnotInteractive")
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void buttonAddImageAnnot_Click(object sender, EventArgs e)
{
    GdViewer1.AddEmbeddedImageAnnotInteractive("", false, Color.Empty, 0, 1);
    if (GdViewer1.GetStat() != GdPictureStatus.OK) MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddEmbeddedImageAnnotInteractive");
}
See Also