GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / AddEmbeddedImageAnnotInteractive Method / AddEmbeddedImageAnnotInteractive(Int32,Boolean,Color,Single,Single) Method
A unique image identifier of the GdPictureImage object representing the required image to render as an annotation. You can obtain this identifier, for example, using methods of the GdPictureImaging class when creating the image resource.
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(Int32,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 the specified image on the page using the image identifier of the GdPictureImage object.

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 ImageID As Integer, _
   ByVal Stroke As Boolean, _
   ByVal BorderColor As Color, _
   ByVal BorderWidth As Single, _
   ByVal Opacity As Single _
) 
public void AddEmbeddedImageAnnotInteractive( 
   int ImageID,
   bool Stroke,
   Color BorderColor,
   float BorderWidth,
   float Opacity
)
public procedure AddEmbeddedImageAnnotInteractive( 
    ImageID: Integer;
    Stroke: Boolean;
    BorderColor: Color;
    BorderWidth: Single;
    Opacity: Single
); 
public function AddEmbeddedImageAnnotInteractive( 
   ImageID : int,
   Stroke : boolean,
   BorderColor : Color,
   BorderWidth : float,
   Opacity : float
);
public: void AddEmbeddedImageAnnotInteractive( 
   int ImageID,
   bool Stroke,
   Color BorderColor,
   float BorderWidth,
   float Opacity
) 
public:
void AddEmbeddedImageAnnotInteractive( 
   int ImageID,
   bool Stroke,
   Color BorderColor,
   float BorderWidth,
   float Opacity
) 

Parameters

ImageID
A unique image identifier of the GdPictureImage object representing the required image to render as an annotation. You can obtain this identifier, for example, using methods of the GdPictureImaging class when creating the image resource.
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.
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.
Private Sub buttonAddImageAnnot_Click(ByVal sender As Object, ByVal e As EventArgs)
    Using image As GdPictureImaging = New GdPictureImaging()
        Dim imageID As Integer = image.CreateGdPictureImageFromFile("image.jpg")
        If image.GetStat() = GdPictureStatus.OK Then
            GdViewer1.AddEmbeddedImageAnnotInteractive(imageID, True, Color.Coral, 0.1F, 0.75F)
            If GdViewer1.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddEmbeddedImageAnnotInteractive")
            image.ReleaseGdPictureImage(imageID)
        Else
            MessageBox.Show("The requested image can't be created. Status: " + image.GetStat().ToString(), "AddEmbeddedImageAnnotInteractive")
        End If
    End Using
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void buttonAddImageAnnot_Click(object sender, EventArgs e)
{
    using (GdPictureImaging image = new GdPictureImaging())
    {
        int imageID = image.CreateGdPictureImageFromFile("image.jpg");
        if (image.GetStat() == GdPictureStatus.OK)
        {
            GdViewer1.AddEmbeddedImageAnnotInteractive(imageID, true, Color.Coral, 0.1f, 0.75f);
            if (GdViewer1.GetStat() != GdPictureStatus.OK)
                MessageBox.Show("Error!  Status: " + GdViewer1.GetStat().ToString(), "AddEmbeddedImageAnnotInteractive");
            image.ReleaseGdPictureImage(imageID);
        }
        else
            MessageBox.Show("The requested image can't be created. Status: " + image.GetStat().ToString(), "AddEmbeddedImageAnnotInteractive");
    }
}
See Also