Gets the current working designer.
Syntax
Visual Basic (Declaration) | |
---|
Public Overridable ReadOnly Property CurrentDesigner As AnnDesigner |
Managed Extensions for C++ | |
---|
public: __property virtual AnnDesigner* get_CurrentDesigner(); |
Return Value
The current working
AnnDesigner derived object
Example
This example subscribes to the CurrentDesignerChanged event of an AnnAutomation object and the Run event of the AnnRunDesigner to show an information message box when an object is clicked while in Run user mode.
Visual Basic | Copy Code |
---|
Public Sub AnnAutomation_CurrentDesigner(ByVal automation As AnnAutomation)
AddHandler automation.CurrentDesignerChanged, AddressOf automation_CurrentDesignerChanged
End Sub
Private Sub automation_CurrentDesignerChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim automation As AnnAutomation = CType(IIf(TypeOf sender Is AnnAutomation, sender, Nothing), AnnAutomation)
If Not automation.CurrentDesigner Is Nothing AndAlso TypeOf automation.CurrentDesigner Is AnnRunDesigner Then
Dim runDesigner As AnnRunDesigner = CType(IIf(TypeOf automation.CurrentDesigner Is AnnRunDesigner, automation.CurrentDesigner, Nothing), AnnRunDesigner)
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 |
C# | Copy Code |
---|
public 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); } } |
Remarks
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