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 As Integer, _
ByVal As Boolean, _
ByVal As Color, _
ByVal As Single, _
ByVal As Single _
)
public void AddEmbeddedImageAnnotInteractive(
int ,
bool ,
Color ,
float ,
float
)
public procedure AddEmbeddedImageAnnotInteractive(
: Integer;
: Boolean;
: Color;
: Single;
: Single
);
public function AddEmbeddedImageAnnotInteractive(
: int,
: boolean,
: Color,
: float,
: float
);
public: void AddEmbeddedImageAnnotInteractive(
int ,
bool ,
Color ,
float ,
float
)
public:
void AddEmbeddedImageAnnotInteractive(
int ,
bool ,
Color ,
float ,
float
)
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).
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");
}
}
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