Dim CmdDock As C1Command.C1CommandDock Dim tbc As WinForm.TabControl = Args(0) Dim TabCtl As C1Command.C1DockingTab = tbc.BaseControl Dim f As WinForm.Form = tbc.Form Dim Location As String = "b" Dim AutoHide As Boolean = Args(1) Dim ParentControl As WinForm.Control = Nothing Dim cnm As String Dim dindex As Byte = 0 '-----获得变量----- Select Case Args.Length Case 3 Location = Args(2) Case 4 Location = Args(2) ParentControl = Args(3) Case 5 Location = Args(2) ParentControl = Args(3) dindex = Args(4) End Select CmdDock = New C1Command.C1CommandDock CmdDock.Name = rand.NextString(8) CmdDock.BackColor = System.Drawing.SystemColors.Control 'CmdDock.DockingStyle = C1Command.DockingStyle.VS2005 CmdDock.AutoDockTop = False CmdDock.AutoDockBottom = False '-----停靠位置----- Select Case Location Case "l" CmdDock.Dock = Windows.Forms.DockStyle.Left Case "r" CmdDock.Dock = Windows.Forms.DockStyle.Right Case "b" CmdDock.Dock = Windows.Forms.DockStyle.Bottom End Select '-----父停靠控件----- If ParentControl IsNot Nothing Then cnm = ParentControl.Name End If If ParentControl Is Nothing Then f.Panel.Controls.Add(CmdDock) ElseIf Typeof ParentControl Is winform.Panel Then f.Controls(cnm).BaseControl.Controls.Add(CmdDock) ElseIf Typeof ParentControl Is winform.SplitContainer Then f.Controls(cnm).BaseControl.Panel2.Controls.Add(CmdDock) ElseIf Typeof ParentControl Is winform.TabControl Then f.Controls(cnm).BaseControl.Tabpages(dindex).Controls.add(CmdDock) End If TabCtl.VisualStyle = C1Command.VisualStyle.Office2007Blue TabCtl.HotTrack = True TabCtl.ShowCaption = True 'TabCtl.ShowTabList = True TabCtl.CanAutoHide = True TabCtl.CanMoveTabs = False CmdDock.Controls.Add(TabCtl) TabCtl.AutoHiding = AutoHide