AddStickyNoteAnnot Method (AnnotationManager)
In This Topic
Adds a new GdPicture/XMP sticky note annotation on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. A sticky note annotation writes the specified text within the defined rectangle area, which can be filled and bordered.
The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeStickyNote. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationStickyNote class right after the successful creation of the annotation object.
Be aware that annotations are always treated relative to the currently selected page.
Syntax
'Declaration
Public Function AddStickyNoteAnnot( _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As String _
) As AnnotationStickyNote
public AnnotationStickyNote AddStickyNoteAnnot(
float ,
float ,
float ,
float ,
string
)
public function AddStickyNoteAnnot(
: Single;
: Single;
: Single;
: Single;
: String
): AnnotationStickyNote;
public function AddStickyNoteAnnot(
: float,
: float,
: float,
: float,
: String
) : AnnotationStickyNote;
public: AnnotationStickyNote* AddStickyNoteAnnot(
float ,
float ,
float ,
float ,
string*
)
public:
AnnotationStickyNote^ AddStickyNoteAnnot(
float ,
float ,
float ,
float ,
String^
)
Parameters
- Left
- The horizontal (X) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
- Top
- The vertical (Y) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
- Width
- The width of the annotation bounding box, in inches.
- Height
- The height of the annotation bounding box, in inches.
- Text
- The content of the newly added annotation, that means the text to be displayed in the annotation bounding box.
Return Value
A GdPicture/XMP AnnotationStickyNote object. The newly added GdPicture/XMP sticky note annotation.
Example
How to add a sticky note 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 annot As GdPicture14.Annotations.AnnotationStickyNote = annotMgr.AddStickyNoteAnnot(1, 1, 2, 2, "Sticky Note by GdPicture")
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
annot.Alignment = System.Drawing.StringAlignment.Center
annot.Author = "GdPicture"
annot.BorderWidth = 0.05F
annot.Fill = True
annot.FillColor = Color.LightBlue
annot.FontSize = 20
annot.Opacity = 0.7F
annot.StrokeColor = Color.DarkBlue
End If
If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
annotMgr.SaveDocumentToJPEG("stickynote.jpeg", 75)
End If
annot.Dispose()
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("stickynote.jpeg")
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddStickyNoteAnnot")
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))
{
GdPicture14.Annotations.AnnotationStickyNote annot = annotMgr.AddStickyNoteAnnot(1, 1, 2, 2, "Sticky Note by GdPicture");
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
{
annot.Alignment = System.Drawing.StringAlignment.Center;
annot.Author = "GdPicture";
annot.BorderWidth = 0.05f;
annot.Fill = true;
annot.FillColor = Color.LightBlue;
annot.FontSize = 20;
annot.Opacity = 0.7f;
annot.StrokeColor = Color.DarkBlue;
}
if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
annotMgr.SaveDocumentToJPEG("stickynote.jpeg", 75);
annot.Dispose();
}
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("stickynote.jpeg");
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddStickyNoteAnnot");
Example
How to add a sticky note 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 annot As GdPicture14.Annotations.AnnotationStickyNote = annotMgr.AddStickyNoteAnnot(1, 1, 2, 2, "Sticky Note by GdPicture")
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
annot.Alignment = System.Drawing.StringAlignment.Center
annot.Author = "GdPicture"
annot.BorderWidth = 0.05F
annot.Fill = True
annot.FillColor = Color.LightBlue
annot.FontSize = 20
annot.Opacity = 0.7F
annot.StrokeColor = Color.DarkBlue
End If
If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
annotMgr.SaveDocumentToJPEG("stickynote.jpeg", 75)
End If
annot.Dispose()
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("stickynote.jpeg")
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddStickyNoteAnnot")
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))
{
GdPicture14.Annotations.AnnotationStickyNote annot = annotMgr.AddStickyNoteAnnot(1, 1, 2, 2, "Sticky Note by GdPicture");
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
{
annot.Alignment = System.Drawing.StringAlignment.Center;
annot.Author = "GdPicture";
annot.BorderWidth = 0.05f;
annot.Fill = true;
annot.FillColor = Color.LightBlue;
annot.FontSize = 20;
annot.Opacity = 0.7f;
annot.StrokeColor = Color.DarkBlue;
}
if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
annotMgr.SaveDocumentToJPEG("stickynote.jpeg", 75);
annot.Dispose();
}
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("stickynote.jpeg");
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddStickyNoteAnnot");
See Also