LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.31
Cancel Method
See Also 
Leadtools.Windows.Annotations Namespace > AnnAutomation Class : Cancel Method



The Cancel Method supports WPF/Silverlight.

The Cancel Method is available in LEADTOOLS Document and Medical Imaging toolkits.

Cancels the operation currently being performed in this AnnAutomationSupported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
Public Overridable Sub Cancel() 
Visual Basic (Usage)Copy Code
Dim instance As AnnAutomation
 
instance.Cancel()
C# 
public virtual void Cancel()
C++/CLI 
public:
virtual void Cancel(); 

Example

This example cancels the drawing of new objects when the mouse is over a certain area on the viewer.

Visual BasicCopy Code
Private Sub AnnAutomation_Cancel()
   ' subclass to the viewer mouse move event
   ' _automation is an AnnAutomation object
   AddHandler _automation.Container.MouseMove, AddressOf Container_MouseMove
End Sub
Private Sub Container_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
   ' check if we have a draw designer currently selected
   If Not _automation.CurrentDesigner Is Nothing AndAlso TypeOf _automation.CurrentDesigner Is AnnDrawDesigner Then
      ' check if we are over the rectangle 100,100 to 200,200
      Dim rc As Rect = New Rect(100, 100, 100, 100)
      If rc.Contains(e.GetPosition(_automation.Container)) Then
         _automation.Cancel()
      End If
   End If
End Sub
C#Copy Code
private void AnnAutomation_Cancel()
{
   // subclass to the viewer mouse move event
   // _automation is an AnnAutomation object
   _automation.Container.MouseMove += new MouseEventHandler(Container_MouseMove);
}
private void Container_MouseMove(object sender, MouseEventArgs e)
{
   // check if we have a draw designer currently selected
   if(_automation.CurrentDesigner != null && _automation.CurrentDesigner is AnnDrawDesigner)
   {
      // check if we are over the rectangle 100,100 to 200,200
      Rect rc = new Rect(100, 100, 100, 100);
      if(rc.Contains(e.GetPosition(_automation.Container)))
         _automation.Cancel();
   }
}
SilverlightCSharpCopy Code
private void AnnAutomation_Cancel()
{
   // subclass to the viewer mouse move event
   // _automation is an AnnAutomation object
   _automation.Container.MouseMove += new MouseEventHandler(Container_MouseMove);
}
private void Container_MouseMove(object sender, MouseEventArgs e)
{
   // check if we have a draw designer currently selected
   if(_automation.CurrentDesigner != null && _automation.CurrentDesigner is AnnDrawDesigner)
   {
      // check if we are over the rectangle 100,100 to 200,200
      Rect rc = new Rect(100, 100, 100, 100);
      if(rc.Contains(e.GetPosition(_automation.Container)))
         _automation.Cancel();
   }
}
SilverlightVBCopy Code
Private Sub AnnAutomation_Cancel()
   ' subclass to the viewer mouse move event
   ' _automation is an AnnAutomation object
   AddHandler _automation.Container.MouseMove, AddressOf Container_MouseMove
End Sub
Private Sub Container_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
   ' check if we have a draw designer currently selected
   If Not _automation.CurrentDesigner Is Nothing AndAlso TypeOf _automation.CurrentDesigner Is AnnDrawDesigner Then
      ' check if we are over the rectangle 100,100 to 200,200
      Dim rc As Rect = New Rect(100, 100, 100, 100)
      If rc.Contains(e.GetPosition(_automation.Container)) Then
         _automation.Cancel()
      End If
   End If
End Sub

Remarks

Cancels any operations currently being performed in this AnnAutomation. An operation can be:
  • (Design user mode) An AnnDrawDesigner is drawing a new object
  • (Design user mode) An AnnEditDesigner is editing an existing object
  • (Design user mode) The user is selecting a group of objects
  • (Run user mode) An AnnRunDesigner is running an object

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also

Cancel requires a Document/Medical product license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features and Unlocking Special LEAD Features.