We are using the dock manager in a new application and have some concerns with performance due to the code being run multiple times in the Activated event of the UserDockForm. We have looked through the forums and documentation to get a better understanding what triggers the "Activated" event, but are not having much luck.
Below is the code being used to create the dock form, and the activated event code. Any help on why this event is fired 3 tiems would be greatly appreciated, and if we should be using a different event let us know.
Private Function CreateDockedDoc(ByVal caption As String, ByVal size As System.Drawing.Size, ByVal formName As String) As UserDockForm |
Dim myform As Form = CType(Me.GetType.Assembly.CreateInstance(formName, True), Form) |
myform.MdiParent = Me |
Dim dockDocument As UserDockForm = CType(myform, UserDockForm) |
dockDocument.Text = caption |
TryCast(DockingManager1.PrimarySite, DockSite).SetDocument(dockDocument) |
dockDocument.CloseButtonVisible = False |
Return dockDocument |
End Function |
Private Sub frmSystemCodePayPeriodSetup_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated |
System.Console.WriteLine("Form activated ........") |
End Sub |