GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / AddCustomAnnotInteractive Method
A private identifier specifying the model of the custom annotation. You need to handle this identifier using the OnCustomAnnotationPaint event to render the desired custom annotation appearance.
Example





In This Topic
AddCustomAnnotInteractive Method
In This Topic
Allows users to interactively add a new custom annotation using the mouse on the current page of the document displayed in the GdViewer control.

Custom annotations are identified through the ModelID identifier, which you subsequently have to use in the OnCustomAnnotationPaint event. This event renders the required annotation according to what you specify for each ModelID inside the event respecting the dimensions users will define using the mouse as well.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeCustom. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationCustom class before or after the successful creation of the annotation object. Please refer to both the BeforeAnnotationAddedByUser and the AnnotationAddedByUser events for how to achieve this.

Be aware that the editing mode for annotations must be enabled using the SetAnnotationEditorMode method, otherwise this method will fail.

Syntax
'Declaration
 
Public Sub AddCustomAnnotInteractive( _
   ByVal ModelID As Integer _
) 
public void AddCustomAnnotInteractive( 
   int ModelID
)
public procedure AddCustomAnnotInteractive( 
    ModelID: Integer
); 
public function AddCustomAnnotInteractive( 
   ModelID : int
);
public: void AddCustomAnnotInteractive( 
   int ModelID
) 
public:
void AddCustomAnnotInteractive( 
   int ModelID
) 

Parameters

ModelID
A private identifier specifying the model of the custom annotation. You need to handle this identifier using the OnCustomAnnotationPaint event to render the desired custom annotation appearance.
Remarks
The GetStat method can be subsequently used to determine if this method has been successful. If the editing mode for annotations is disabled, the method will fail.

You can also find the use of this method in our Annotations Sample here.

Just to inform you that custom annotations are not supported by the COM Interop edition.

Example
How to allow users to interactively add a custom annotation on the currently displayed page.
'We assume that the GdViewer1 control has been properly integrated.
'Please refer to the implementation of the OnCustomAnnotationPaint() event for below used custom annotation models.
Sub buttonAddCustomAnnot_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim triangleModel As Integer = 1
    Dim crossModel As Integer = 2
            
    'Add a triangle annotation.
    GdViewer1.AddCustomAnnotInteractive(triangleModel)
            
    'Add a cross annotation.
    'GdViewer1.AddCustomAnnotInteractive(crossModel)
End Sub
//We assume that the GdViewer1 control has been properly integrated.
//Please refer to the implementation of the OnCustomAnnotationPaint() event for below used custom annotation models.
void buttonAddCustomAnnot_Click(object sender, EventArgs e)
{
    int triangleModel = 1, crossModel = 2;
            
    //Add a triangle annotation.
    GdViewer1.AddCustomAnnotInteractive(triangleModel);
            
    //Add a cross annotation.
    //GdViewer1.AddCustomAnnotInteractive(crossModel);
}
See Also