LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly)
LEAD Technologies, Inc

BeforeObjectChanged Event

Example 





Occurs before an AnnObject is about to be changed. .NET support Silverlight support
Syntax
public event EventHandler<AnnBeforeObjectChangedEventArgs> BeforeObjectChanged
'Declaration
 
Public Event BeforeObjectChanged As EventHandler(Of AnnBeforeObjectChangedEventArgs)
'Usage
 
Dim instance As AnnAutomation
Dim handler As EventHandler(Of AnnBeforeObjectChangedEventArgs)
 
AddHandler instance.BeforeObjectChanged, handler
public event EventHandler<AnnBeforeObjectChangedEventArgs> BeforeObjectChanged
add_BeforeObjectChanged(function(sender, e))
remove_BeforeObjectChanged(function(sender, e))

public:
event EventHandler<AnnBeforeObjectChangedEventArgs^>^ BeforeObjectChanged
Event Data

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

PropertyDescription
Cancel Gets or sets a value indicating whether the change should be canceled. .NET support Silverlight support
ChangeType Gets the type of change. .NET support Silverlight support
Designer Gets the designer responsible for the change. .NET support Silverlight support
Objects Gets the objects that have been changed. .NET support Silverlight support
Remarks
This event will be fired before an AnnObject is about to be modified by this AnnAutomation.
Example
Copy CodeCopy Code  
Private 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 stroke
   If e.ChangeType = AnnObjectChangedType.Stroke Then
      e.Cancel = True
   End If
End Sub
private 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 stroke
   if(e.ChangeType == AnnObjectChangedType.Stroke)
      e.Cancel = true;
}
private 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 stroke
   if(e.ChangeType == AnnObjectChangedType.Stroke)
      e.Cancel = true;
}
Private 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 stroke
   If e.ChangeType = AnnObjectChangedType.Stroke Then
      e.Cancel = True
   End If
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AnnAutomation Class
AnnAutomation Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.