Ok, lets try again:
The problem:
When you call frmPluginForm.MdiParent = MDIForm
.NET destroy frame and create again with WS_EX_MDICHILD style, so all commandbarrs and dockingpanes objects destroyed. Unfortunatelly from ActiveX code We can't catch this event end recreate them.
The solution
Solution is to create DockingPane and CommandBars after you call it
Sample
create InitBars method and call it after you change frame style:
Public Sub InitBars()
Me.AxDockingPane1 = New AxXtremeDockingPane.AxDockingPane
Me.AxCommandBars1 = New AxXtremeCommandBars.AxCommandBars
CType(Me.AxDockingPane1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.AxCommandBars1, System.ComponentModel.ISupportInitialize).BeginInit()
'
'AxDockingPane1
'
Me.AxDockingPane1.Enabled = True
Me.AxDockingPane1.Location = New System.Drawing.Point(24, 32)
Me.AxDockingPane1.Name = "AxDockingPane1"
Me.AxDockingPane1.Size = New System.Drawing.Size(17, 16)
Me.AxDockingPane1.TabIndex = 0
'
'AxCommandBars1
'
Me.AxCommandBars1.Enabled = True
Me.AxCommandBars1.Location = New System.Drawing.Point(8, 56)
Me.AxCommandBars1.Name = "AxCommandBars1"
Me.AxCommandBars1.Size = New System.Drawing.Size(24, 24)
Me.AxCommandBars1.TabIndex = 1
Me.Controls.Add(Me.AxCommandBars1)
Me.Controls.Add(Me.AxDockingPane1)
CType(Me.AxDockingPane1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.AxCommandBars1, System.ComponentModel.ISupportInitialize).EndInit()
Dim paneA As Pane = AxDockingPane1.CreatePane(1, 200, 120, DockingDirection.DockLeftOf, Nothing)
paneA.Title = "Pane A"
Dim paneB As Pane = AxDockingPane1.CreatePane(2, 200, 120, DockingDirection.DockRightOf, paneA)
paneB.Title = "Pane B"
'AxDockingPane1.Options.HideClient = True
'AxDockingPane1.Options.ShowCaption = False
AxDockingPane1.Options.ThemedFloatingFrames = True
AxDockingPane1.Options.LunaColors = False
AxDockingPane1.SetCommandBars( Me.AxCommandBars1.GetDispatch)
AxCommandBars1.ActiveMenuBar.Controls.Add(XTPControlType.xtp ControlButton, 10, "File")
End Sub
Public Sub ShowPluginForm(ByVal MDIForm As System.Windows.Forms.Form) Implements FrameNET.Interface.IPlugin.ShowPluginForm
Try
frmPluginForm = New frmchild
frmPluginForm.MdiParent = MDIForm
frmPluginForm.Show()
frmPluginForm.InitBars()
Catch err As Exception
MsgBox("Error in ShowPlugin." & vbCrLf & err.Message & vbCrLf & err.Source, MsgBoxStyle.Critical, "Security Plugin")
End Try
End Sub
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|