AddLineArrowAnnot Method (AnnotationManager)
In This Topic
Adds a new GdPicture/XMP line arrow annotation on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. This annotation depicts a straight line with an arrow on its ending point.
The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeLineArrow. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationLineArrow class right after the successful creation of the annotation object.
Be aware that annotations are always treated relative to the currently selected page.
Adds a new GdPicture/XMP line arrow annotation on the selected page of the document currently handled by this AnnotationManager object.
Syntax
'Declaration
Public Function AddLineArrowAnnot( _
ByVal As Color, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single _
) As AnnotationLineArrow
public AnnotationLineArrow AddLineArrowAnnot(
Color ,
float ,
float ,
float ,
float
)
public function AddLineArrowAnnot(
: Color;
: Single;
: Single;
: Single;
: Single
): AnnotationLineArrow;
public function AddLineArrowAnnot(
: Color,
: float,
: float,
: float,
: float
) : AnnotationLineArrow;
public: AnnotationLineArrow* AddLineArrowAnnot(
Color ,
float ,
float ,
float ,
float
)
public:
AnnotationLineArrow^ AddLineArrowAnnot(
Color ,
float ,
float ,
float ,
float
)
Parameters
- BorderColor
- A color object that defines the required color of the newly added line arrow annotation.
It corresponds to the AnnotationLineArrow.StrokeColor property.
- SrcLeft
- The horizontal (X) coordinate of the starting point of the drawn line, in inches.
- SrcTop
- The vertical (Y) coordinate of the starting point of the drawn line, in inches.
- DstLeft
- The horizontal (X) coordinate of the ending point of the drawn line, in inches, where the arrow is located.
- DstTop
- The vertical (Y) coordinate of the ending point of the drawn line, in inches, where the arrow is located.
Return Value
A GdPicture/XMP AnnotationLineArrow object. The newly added GdPicture/XMP line arrow annotation.
Example
How to add a line arrow annotation to a newly created image.
Dim status As GdPictureStatus = GdPictureStatus.OK
Using image As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = image.CreateNewGdPictureImage(1000, 1600, CShort(32), Color.White)
status = image.GetStat()
If (status = GdPictureStatus.OK) AndAlso (imageID <> 0) Then
Using annotMgr As AnnotationManager = New AnnotationManager()
If (annotMgr.InitFromGdPictureImage(imageID) = GdPictureStatus.OK) AndAlso
(annotMgr.SelectPage(1) = GdPictureStatus.OK) Then
Dim left As Single = 1, top As Single = 1, width As Single = 5, dist As Single = 1
Dim annotArrow As GdPicture14.Annotations.AnnotationLineArrow = Nothing
For i As Integer = 0 To 2
annotArrow = annotMgr.AddLineArrowAnnot(Color.BlueViolet, left, top + i * dist, left + width - dist * i, top + dist * i)
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annotArrow IsNot Nothing) Then
annotArrow.Author = "GdPicture"
annotArrow.BorderWidth = 0.15F - i * 0.05F
annotArrow.Opacity = 1 - i * 0.25F
End If
annotArrow.Dispose()
Next
If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
annotMgr.SaveDocumentToJPEG("arrow.jpeg", 75)
End If
End If
status = annotMgr.GetStat()
annotMgr.Close()
End Using
image.ReleaseGdPictureImage(imageID)
End If
End Using
'We assume that the GdViewer1 control has been integrated into your application.
If status = GdPictureStatus.OK Then
GdViewer1.DisplayFromFile("arrow.jpeg")
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddLineArrowAnnot")
End If
GdPictureStatus status = GdPictureStatus.OK;
using (GdPictureImaging image = new GdPictureImaging())
{
int imageID = image.CreateNewGdPictureImage(1000, 1600, 32, Color.White);
status = image.GetStat();
if ((status == GdPictureStatus.OK) && (imageID != 0))
{
using (AnnotationManager annotMgr = new AnnotationManager())
{
if ((annotMgr.InitFromGdPictureImage(imageID) == GdPictureStatus.OK) &&
(annotMgr.SelectPage(1) == GdPictureStatus.OK))
{
float left = 1, top = 1, width = 5, dist = 1;
GdPicture14.Annotations.AnnotationLineArrow annotArrow = null;
for (int i = 0; i < 3; i++)
{
annotArrow = annotMgr.AddLineArrowAnnot(Color.BlueViolet, left, top + i*dist, left + width-dist*i, top+dist*i);
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annotArrow != null))
{
annotArrow.Author = "GdPicture";
annotArrow.BorderWidth = 0.15f - i*0.05f;
annotArrow.Opacity = 1 - i* 0.25f;
}
annotArrow.Dispose();
}
if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
annotMgr.SaveDocumentToJPEG("arrow.jpeg", 75);
}
status = annotMgr.GetStat();
annotMgr.Close();
}
image.ReleaseGdPictureImage(imageID);
}
}
//We assume that the GdViewer1 control has been integrated into your application.
if (status == GdPictureStatus.OK)
GdViewer1.DisplayFromFile("arrow.jpeg");
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddLineArrowAnnot");
Example
How to add a line arrow annotation to a newly created image.
Dim status As GdPictureStatus = GdPictureStatus.OK
Using image As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = image.CreateNewGdPictureImage(1000, 1600, CShort(32), Color.White)
status = image.GetStat()
If (status = GdPictureStatus.OK) AndAlso (imageID <> 0) Then
Using annotMgr As AnnotationManager = New AnnotationManager()
If (annotMgr.InitFromGdPictureImage(imageID) = GdPictureStatus.OK) AndAlso
(annotMgr.SelectPage(1) = GdPictureStatus.OK) Then
Dim left As Single = 1, top As Single = 1, width As Single = 5, dist As Single = 1
Dim annotArrow As GdPicture14.Annotations.AnnotationLineArrow = Nothing
For i As Integer = 0 To 2
annotArrow = annotMgr.AddLineArrowAnnot(Color.BlueViolet, left, top + i * dist, left + width - dist * i, top + dist * i)
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annotArrow IsNot Nothing) Then
annotArrow.Author = "GdPicture"
annotArrow.BorderWidth = 0.15F - i * 0.05F
annotArrow.Opacity = 1 - i * 0.25F
End If
annotArrow.Dispose()
Next
If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
annotMgr.SaveDocumentToJPEG("arrow.jpeg", 75)
End If
End If
status = annotMgr.GetStat()
annotMgr.Close()
End Using
image.ReleaseGdPictureImage(imageID)
End If
End Using
'We assume that the GdViewer1 control has been integrated into your application.
If status = GdPictureStatus.OK Then
GdViewer1.DisplayFromFile("arrow.jpeg")
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddLineArrowAnnot")
End If
GdPictureStatus status = GdPictureStatus.OK;
using (GdPictureImaging image = new GdPictureImaging())
{
int imageID = image.CreateNewGdPictureImage(1000, 1600, 32, Color.White);
status = image.GetStat();
if ((status == GdPictureStatus.OK) && (imageID != 0))
{
using (AnnotationManager annotMgr = new AnnotationManager())
{
if ((annotMgr.InitFromGdPictureImage(imageID) == GdPictureStatus.OK) &&
(annotMgr.SelectPage(1) == GdPictureStatus.OK))
{
float left = 1, top = 1, width = 5, dist = 1;
GdPicture14.Annotations.AnnotationLineArrow annotArrow = null;
for (int i = 0; i < 3; i++)
{
annotArrow = annotMgr.AddLineArrowAnnot(Color.BlueViolet, left, top + i*dist, left + width-dist*i, top+dist*i);
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annotArrow != null))
{
annotArrow.Author = "GdPicture";
annotArrow.BorderWidth = 0.15f - i*0.05f;
annotArrow.Opacity = 1 - i* 0.25f;
}
annotArrow.Dispose();
}
if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
annotMgr.SaveDocumentToJPEG("arrow.jpeg", 75);
}
status = annotMgr.GetStat();
annotMgr.Close();
}
image.ReleaseGdPictureImage(imageID);
}
}
//We assume that the GdViewer1 control has been integrated into your application.
if (status == GdPictureStatus.OK)
GdViewer1.DisplayFromFile("arrow.jpeg");
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddLineArrowAnnot");
See Also