GdPicture.NET Reference Guide
DisplayTextEditBox Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : DisplayTextEditBox Method
The 0-based index of the required annotation within the current page of the displayed document. It must be a value from 0 to GetAnnotationCount-1.
Allows users to modify the annotation text directly within the defined annotation's rectangle area. This method is only applicable to sticky note and text annotations.

The method can be particularly useful if you want to let users add the new text (the annotation content) of the sticky note or text annotation right after they create it. The annotation's rectangle area will serve as editable dialogue box. Please refer to the attached example how it works.

The AnnotationStartEditingText event, respectively the PreviewAnnotationStartEditingText event is raised after opening the dialogue box.

Syntax
'Declaration
 
Public Function DisplayTextEditBox( _
   ByVal AnnotationIdx As Integer _
) As GdPictureStatus
public GdPictureStatus DisplayTextEditBox( 
   int AnnotationIdx
)
public function DisplayTextEditBox( 
    AnnotationIdx: Integer
): GdPictureStatus; 
public function DisplayTextEditBox( 
   AnnotationIdx : int
) : GdPictureStatus;
public: GdPictureStatus DisplayTextEditBox( 
   int AnnotationIdx
) 
public:
GdPictureStatus DisplayTextEditBox( 
   int AnnotationIdx
) 

Parameters

AnnotationIdx
The 0-based index of the required annotation within the current page of the displayed document. It must be a value from 0 to GetAnnotationCount-1.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks
Be aware that this method is only meaningful for sticky note and text annotations; otherwise, the method will fail.

Please note that this method expects to have the GdPicture XMP/Annotations Plugin to be unlocked. The method only handles GdPicture/XMP annotations as well.

Just to remind you that the AnnotationStartEditingText event, respectively the PreviewAnnotationStartEditingText event is raised using this method.

Example
How to prompt the user to modify the annotation text by catching the AnnotationAddedByUser event.
'We assume that the GdViewer1 control has been properly integrated
'and the AnnotationAddedByUser event has been properly added.
Sub GdViewer1_AnnotationAddedByUser(ByVal AnnotationIdx As Integer) Handles GdViewer1.AnnotationAddedByUser
    Dim annot As GdPicture14.Annotations.Annotation = GdViewer1.GetAnnotationFromIdx(AnnotationIdx)
    If TypeOf annot Is GdPicture14.Annotations.AnnotationStickyNote OrElse
       TypeOf annot Is GdPicture14.Annotations.AnnotationText Then
        GdViewer1.DisplayTextEditBox(AnnotationIdx)
    End If
End Sub
//We assume that the GdViewer1 control has been properly integrated.
//and the AnnotationAddedByUser event has been properly added.
void GdViewer1_AnnotationAddedByUser(int AnnotationIdx)
{
    GdPicture14.Annotations.Annotation annot = GdViewer1.GetAnnotationFromIdx(AnnotationIdx);
    if (annot is GdPicture14.Annotations.AnnotationStickyNote ||
        annot is GdPicture14.Annotations.AnnotationText)
    {
        GdViewer1.DisplayTextEditBox(AnnotationIdx);
    }
}
See Also

Reference

GdViewer Class
GdViewer Members
HideTextEditBox Method
GetAnnotationCount Method
GetAnnotationFromIdx Method
AnnotationAddedByUserEvent Field
AnnotationStartEditingText Event
AnnotationEndEditingText Event
PreviewAnnotationStartEditingText Event