←Select platform

Draw Event

Summary

Occurs when an AnnObject is being drawn.

Syntax

C#
VB
Java
Objective-C
WinRT C#
C++
public event EventHandler<AnnDrawDesignerEventArgs> Draw 
Public Event Draw As EventHandler(Of AnnDrawDesignerEventArgs) 
public event EventHandler<AnnDrawDesignerEventArgs> Draw 
-(void) automation:(LTAnnAutomation*) automation  
      drawWithArgs:(LTAnnDrawDesignerEventArgs*) e; 
             
public void addDrawDesignerdListener(AnnDrawDesignerListener listener) 
public void removeDrawDesignerListener(AnnDrawDesignerListener listener) 
             
add_Draw(function(sender, e)) 
remove_Draw(function(sender, e)) 
public:  
   event EventHandler<AnnDrawDesignerEventArgs^>^ Draw 

Event Data

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

PropertyDescription
Cancel Gets or sets a value indicating whether the draw operation should be canceled.
Object Gets the AnnObject that is being drawn.
OperationStatus Gets the status of the draw operation.
Remarks

When an object is being drawn, the automation object will hook the object draw designer's AnnDrawDesigner.Draw to this event. Therefore, instead of hooking and unhooking to the various designers draw events, you can simply subscribe to this event once.

Example

This example will show how to stop drawing new line objects.

Start with the AnnAutomationManager example, remove all the code inside the example function (search for the // TODO: add example code here comment) and insert the following code:

Click the example button then try to draw a line object.

C#
using Leadtools.Annotations.Automation; 
using LeadtoolsExamples.Common; 
using Leadtools.Annotations.Core; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Annotations.Rendering; 
using Leadtools.Annotations.WinForms; 
 
public void AnnAutomation_Draw() 
{ 
   // Hook to the automation's Draw event 
   _automation.Draw += _automation_Draw; 
} 
 
void _automation_Draw(object sender, AnnDrawDesignerEventArgs e) 
{ 
   // Check if we are drawing a line and we just started, if so, cancel it 
   if (_automation.Manager.CurrentObjectId == AnnObject.LineObjectId && 
      e.OperationStatus == AnnDesignerOperationStatus.Start) 
   { 
      Debug.WriteLine("Canceling line..."); 
      e.Cancel = true; 
   } 
} 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Automation Assembly