Leadtools.Annotations Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
BeforeObjectChanged Event
See Also  Example
Leadtools.Annotations Namespace > AnnAutomation Class : BeforeObjectChanged Event




Occurs before an AnnObject is about to be changed.

Syntax

Visual Basic (Declaration) 
Public Event BeforeObjectChanged() As EventHandler(Of AnnBeforeObjectChangedEventArgs)
Visual Basic (Usage)Copy Code
Dim instance As AnnAutomation
Dim handler As EventHandler(Of AnnBeforeObjectChangedEventArgs)
 
AddHandler instance.BeforeObjectChanged, handler
C# 
public event EventHandler<AnnBeforeObjectChangedEventArgs> BeforeObjectChanged()
Managed Extensions for C++ 
public: __event EventHandler<AnnBeforeObjectChangedEventArgs>* BeforeObjectChanged();
C++/CLI 
public:
event EventHandler<AnnBeforeObjectChangedEventArgs>^ BeforeObjectChanged();

Example

This example will prevent changing the pen of all annotation objects.

Visual BasicCopy Code
Public Sub AnnAutomation_BeforeObjectChanged(ByVal manager As AnnAutomationManager)
   ' subscribe to the BeforeObjectChanged of all automations
   For Each automation As AnnAutomation In manager.Automations
      AddHandler automation.BeforeObjectChanged, AddressOf automation_BeforeObjectChanged
   Next automation
End Sub
Private Sub automation_BeforeObjectChanged(ByVal sender As Object, ByVal e As AnnBeforeObjectChangedEventArgs)
   ' prevent changing the pen
   If e.ChangeType = AnnObjectChangedType.Pen Then
      e.Cancel = True
   End If
End Sub
C#Copy Code
public void AnnAutomation_BeforeObjectChanged(AnnAutomationManager manager) 

  // subscribe to the BeforeObjectChanged of all automations 
  foreach(AnnAutomation automation in manager.Automations) 
     automation.BeforeObjectChanged += new EventHandler<AnnBeforeObjectChangedEventArgs>(automation_BeforeObjectChanged); 

private void automation_BeforeObjectChanged(object sender, AnnBeforeObjectChangedEventArgs e) 

  // prevent changing the pen 
  if(e.ChangeType == AnnObjectChangedType.Pen) 
     e.Cancel = true; 
}

Remarks

This event will be fired before an AnnObject is about to be modified by this AnnAutomation

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Annotations requires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features