The BeforeObjectChanged Event is available in LEADTOOLS Document and Medical Imaging toolkits.
Occurs before an
AnnObject is about to be changed.
Syntax
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.
Property | Description |
---|
Cancel | Gets or sets a value indicating whether the change should be canceled. |
ChangeType | Gets the type of change. |
Designer | Gets the designer responsible for the change. |
Objects | Gets the objects that have been changed. |
Example
This example will prevent changing the pen of all annotation objects.
Visual Basic | Copy 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
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7
See Also