GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / AnnotationSelected Event
Example





In This Topic
AnnotationSelected Event (GdViewer)
In This Topic
This event is raised when a GdPicture/XMP annotation has been selected or deselected.

Please check the corresponded GdViewer.AnnotationSelectedEventHandler for given parameters.

Syntax
'Declaration
 
Public Event AnnotationSelected As GdViewer.AnnotationSelectedEventHandler
public event GdViewer.AnnotationSelectedEventHandler AnnotationSelected
public event AnnotationSelected: GdViewer.AnnotationSelectedEventHandler; 
In JScript, you can handle the events defined by another class, but you cannot define your own.
public: __event GdViewer.AnnotationSelectedEventHandler* AnnotationSelected
public:
event GdViewer.AnnotationSelectedEventHandler^ AnnotationSelected
Remarks
Be aware, that this event only handles GdPicture/XMP annotations.
Example
How to add this event to your GdViewer control. This example shows you how to find out if the concerned annotation is selected or deselected.
'We assume that the GdViewer1 control has been properly integrated.
Friend WithEvents GdViewer1 As GdPicture14.GdViewer
            
'Add the event.
AddHandler GdViewer1.AnnotationSelected, AddressOf GdViewer1_AnnotationSelected
            
'Define the event.
Sub GdViewer1_AnnotationSelected(ByVal AnnotationIdx As Integer) Handles GdViewer1.AnnotationSelected
    Dim annot As GdPicture14.Annotations.Annotation = GdViewer1.GetAnnotationFromIdx(AnnotationIdx)
    If annot.Selected Then
        MessageBox.Show("The annotation with the index " + AnnotationIdx.ToString() + " has been selected.", "GdViewer.AnnotationSelected")
    Else
        MessageBox.Show("The annotation with the index " + AnnotationIdx.ToString() + " has been deselected.", "GdViewer.AnnotationSelected")
    End If
End Sub
//We assume that the GdViewer1 control has been properly integrated.
            
//Add the event.
GdViewer1.AnnotationSelected += GdViewer1_AnnotationSelected;
            
//Define the event.
void GdViewer1_AnnotationSelected(int AnnotationIdx)
{
    GdPicture14.Annotations.Annotation annot = GdViewer1.GetAnnotationFromIdx(AnnotationIdx);
    if (annot.Selected)
        MessageBox.Show("The annotation with the index " + AnnotationIdx.ToString() + " has been selected.", "GdViewer.AnnotationSelected");
    else
        MessageBox.Show("The annotation with the index " + AnnotationIdx.ToString() + " has been deselected.", "GdViewer.AnnotationSelected");
}
See Also