←Select platform

CurrentDesigner Property

Summary

Gets the current working designer.

Syntax

C#
VB
C++
public AnnDesigner CurrentDesigner { get; } 
  
Public ReadOnly Property CurrentDesigner As Leadtools.Windows.Annotations.AnnDesigner 

Property Value

The current working AnnDesigner derived object

Remarks

At any given time, the AnnAutomation can have a working AnnDesigner derived object as follows:

Designer Base Class Notes
null (Nothing in Visual Basic) (Design and Run user mode) no designer is currently active.
AnnDrawDesigner (Design user mode) The AnnAutomation is currently drawing or about to draw a new object
AnnEditDesigner (Design user mode) One or more objects are currently being edited or are about to be edited
AnnRunDesigner (Run user mode) An object is currently being run or about to be run

This property allows you to hook into the current designer and change or monitor its status while it is running. For example, you can determine if CurrentDesigner is an AnnDrawDesigner derived class and subscribe to the Draw event and so forth.

Example

This example subscribes to the CurrentDesignerChanged event of an AnnAutomation object and the Run event of the AnnDrawDesigner to show an information message box when an object is clicked while in Run user mode.

C#
VB
Silverlight C#
Silverlight VB
using Leadtools.Windows.Controls; 
using Leadtools.Windows.Annotations; 
using Leadtools.Demos; 
using Leadtools.Help; 
 
private void AnnAutomation_CurrentDesigner(AnnAutomation automation) 
{ 
   // subscribe to the DesignerChanged event of the automation 
   automation.CurrentDesignerChanged += new EventHandler(automation_CurrentDesignerChanged); 
} 
 
private void automation_CurrentDesignerChanged(object sender, EventArgs e) 
{ 
   // check if the current designer is a run designer 
   AnnAutomation automation = sender as AnnAutomation; 
   if (automation.CurrentDesigner != null && automation.CurrentDesigner is AnnRunDesigner) 
   { 
      AnnRunDesigner runDesigner = automation.CurrentDesigner as AnnRunDesigner; 
      // subscribe to this run designer Run event 
      runDesigner.Run += new EventHandler<AnnRunDesignerEventArgs>(runDesigner_Run); 
   } 
} 
 
private void runDesigner_Run(object sender, AnnRunDesignerEventArgs e) 
{ 
   if (e.OperationStatus == AnnDesignerOperationStatus.End) 
   { 
      string message = string.Format("Run object of type {0}, hyperlink = {1}", e.Object.GetType().Name, e.Object.Hyperlink); 
      MessageBox.Show(message); 
   } 
} 
Imports Leadtools.Windows.Controls 
Imports Leadtools.Windows.Annotations 
 
Private Sub AnnAutomation_CurrentDesigner(ByVal automation As AnnAutomation) 
   ' subscribe to the DesignerChanged event of the automation 
   AddHandler automation.CurrentDesignerChanged, AddressOf automation_CurrentDesignerChanged 
End Sub 
 
Private Sub automation_CurrentDesignerChanged(ByVal sender As Object, ByVal e As EventArgs) 
   ' check if the current designer is a run designer 
   Dim automation As AnnAutomation = DirectCast(sender, AnnAutomation) 
   If Not automation.CurrentDesigner Is Nothing AndAlso TypeOf automation.CurrentDesigner Is AnnRunDesigner Then 
      Dim runDesigner As AnnRunDesigner = DirectCast(automation.CurrentDesigner, AnnRunDesigner) 
      ' subscribe to this run designer Run event 
      AddHandler runDesigner.Run, AddressOf runDesigner_Run 
   End If 
End Sub 
 
Private Sub runDesigner_Run(ByVal sender As Object, ByVal e As AnnRunDesignerEventArgs) 
   If e.OperationStatus = AnnDesignerOperationStatus.End Then 
      Dim message As String = String.Format("Run object of type {0}, hyperlink = {1}", e.Object.GetType().Name, e.Object.Hyperlink) 
      MessageBox.Show(message) 
   End If 
End Sub 
using Leadtools.Windows.Controls; 
using Leadtools.Windows.Annotations; 
using Leadtools.Examples; 
using Leadtools.Silverlight.Demos; 
//using Leadtools.Help; 
 
private void AnnAutomation_CurrentDesigner(AnnAutomation automation) 
{ 
   // subscribe to the DesignerChanged event of the automation 
   automation.CurrentDesignerChanged += new EventHandler(automation_CurrentDesignerChanged); 
} 
 
private void automation_CurrentDesignerChanged(object sender, EventArgs e) 
{ 
   // check if the current designer is a run designer 
   AnnAutomation automation = sender as AnnAutomation; 
   if (automation.CurrentDesigner != null && automation.CurrentDesigner is AnnRunDesigner) 
   { 
      AnnRunDesigner runDesigner = automation.CurrentDesigner as AnnRunDesigner; 
      // subscribe to this run designer Run event 
      runDesigner.Run += new EventHandler<AnnRunDesignerEventArgs>(runDesigner_Run); 
   } 
} 
 
private void runDesigner_Run(object sender, AnnRunDesignerEventArgs e) 
{ 
   if (e.OperationStatus == AnnDesignerOperationStatus.End) 
   { 
      string message = string.Format("Run object of type {0}, hyperlink = {1}", e.Object.GetType().Name, e.Object.Hyperlink); 
      MessageBox.Show(message); 
   } 
} 
Imports Leadtools.Windows.Controls 
Imports Leadtools.Windows.Annotations 
Imports Leadtools.Silverlight.Demos 
'using Leadtools.Help; 
 
Private Sub AnnAutomation_CurrentDesigner(ByVal automation As AnnAutomation) 
   ' subscribe to the DesignerChanged event of the automation 
   AddHandler automation.CurrentDesignerChanged, AddressOf automation_CurrentDesignerChanged 
End Sub 
 
Private Sub automation_CurrentDesignerChanged(ByVal sender As Object, ByVal e As EventArgs) 
   ' check if the current designer is a run designer 
   Dim automation As AnnAutomation = TryCast(sender, AnnAutomation) 
   If Not automation.CurrentDesigner Is Nothing AndAlso TypeOf automation.CurrentDesigner Is AnnRunDesigner Then 
      Dim runDesigner As AnnRunDesigner = TryCast(automation.CurrentDesigner, AnnRunDesigner) 
      ' subscribe to this run designer Run event 
      AddHandler runDesigner.Run, AddressOf runDesigner_Run 
   End If 
End Sub 
 
Private Sub runDesigner_Run(ByVal sender As Object, ByVal e As AnnRunDesignerEventArgs) 
   If e.OperationStatus = AnnDesignerOperationStatus.End Then 
      Dim message As String = String.Format("Run object of type {0}, hyperlink = {1}", e.Object.GetType().Name, e.Object.Hyperlink) 
      MessageBox.Show(message) 
   End If 
End Sub 

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.Windows.Annotations Assembly