GdPicture.NET.14
GdPicture14.WPF Namespace / GdViewer Class / AnnotationAddedByUser Event
Example





In This Topic
AnnotationAddedByUser Event (GdViewer)
In This Topic
This event is raised right after a new GdPicture/XMP annotation has been added by a user. This event occurs in the mouse up action.

The event makes use of bubble routing strategy. Please check the corresponded GdViewer.AnnotationAddedByUserEventArgs for given parameters.

Syntax
'Declaration
 
Public Event AnnotationAddedByUser As GdViewer.AnnotationAddedByUserHandler
public event GdViewer.AnnotationAddedByUserHandler AnnotationAddedByUser
public event AnnotationAddedByUser: GdViewer.AnnotationAddedByUserHandler; 
In JScript, you can handle the events defined by another class, but you cannot define your own.
public: __event GdViewer.AnnotationAddedByUserHandler* AnnotationAddedByUser
public:
event GdViewer.AnnotationAddedByUserHandler^ AnnotationAddedByUser
Event Data

The event handler receives an argument of type GdViewer.AnnotationAddedByUserEventArgs containing data related to this event. The following GdViewer.AnnotationAddedByUserEventArgs properties provide information specific to this event.

PropertyDescription
The 0-based index of the newly added annotation within the current page of the displayed document. It is a value from 0 to GetAnnotationCount-1.  
(Inherited from System.Windows.RoutedEventArgs)
(Inherited from System.Windows.RoutedEventArgs)
(Inherited from System.Windows.RoutedEventArgs)
(Inherited from System.Windows.RoutedEventArgs)
Remarks
Be aware, that this event only handles GdPicture/XMP annotations.
Example
How to utilize this event in your GdViewer control. This example shows you how to address the currently added annotation for changing its properties.
'We assume that the GdViewer1 control has been properly integrated
'and the AnnotationAddedByUser event has been properly added.
            
'Define the event.
Sub GdViewer1_AnnotationAddedByUser(ByVal sender As Object, ByVal e As GdPicture14.WPF.GdViewer.AnnotationAddedByUserEventArgs)
    Dim annot As GdPicture14.Annotations.Annotation = GdViewer1.GetAnnotationFromIdx(e.AnnotationIdx)
    annot.Author = "GdPicture"
    If TypeOf annot Is GdPicture14.Annotations.AnnotationStickyNote OrElse
       TypeOf annot Is GdPicture14.Annotations.AnnotationText Then
       GdViewer1.DisplayTextEditBox(e.AnnotationIdx)
    End If
End Sub
//We assume that the GdViewer1 control has been properly integrated
//and the AnnotationAddedByUser event has been properly added.
            
//Define the event.
void GdViewer1_AnnotationAddedByUser(object sender, GdPicture14.WPF.GdViewer.AnnotationAddedByUserEventArgs e)
{
    GdPicture14.Annotations.Annotation annot = GdViewer1.GetAnnotationFromIdx(e.AnnotationIdx);
    annot.Author = "GdPicture";
    if (annot is GdPicture14.Annotations.AnnotationStickyNote ||
        annot is GdPicture14.Annotations.AnnotationText)
    {
        GdViewer1.DisplayTextEditBox(e.AnnotationIdx);
    }
}
See Also