DockContainerItem CreateAddInContainer(object addIn) { DockContainerItem document = new DockContainerItem(); document.Text = GetModuleName(addIn); if (addIn is Control) { (addIn as Control).Dock = DockStyle.Fill; document.Control = addIn as Control; } else if (addIn is System.Windows.Controls.Control) { System.Windows.Forms.Integration.ElementHost wpfHost = new System.Windows.Forms.Integration.ElementHost(); wpfHost.Dock = System.Windows.Forms.DockStyle.Fill; wpfHost.Location = new System.Drawing.Point(0, 0); wpfHost.TabIndex = 0; wpfHost.Child = (addIn as System.Windows.Controls.Control); this.Controls.Add(wpfHost); document.Control = wpfHost; } Bar bar = GetFirstDocumentBar(); bar.Items.Add(document); bar.SelectedDockTab = bar.Items.IndexOf(document); bar.RecalcLayout(); ModuleManager.StartModule(addIn, this); return(document); }
private void button1_Click(object sender, System.EventArgs e) { Bar bar = this.Parent as Bar; if (bar == null) { MessageBox.Show("Control is not on the bar"); } else { // If reference to DotNetBarManager is needed this is how to get it DotNetBarManager manager = bar.Owner as DotNetBarManager; DockContainerItem dockItem = null; if (bar.SelectedDockTab < 0) // There is only one DockContainerItem on the bar { dockItem = bar.Items[0] as DockContainerItem; } else { dockItem = bar.Items[bar.SelectedDockTab] as DockContainerItem; } MessageBox.Show("Control is on the bar: " + bar.Name + " (" + bar.Text + ") and on DockContainerItem: " + dockItem.Name + " (" + dockItem.Text + ")"); } }
private void ContainerLoadControl(object sender, System.EventArgs e) { BaseItem item = sender as BaseItem; if (item == null) { return; } if (item.Name == "cTaskShowatstartup") { ControlContainerItem containerItem = item as ControlContainerItem; CheckBox box = new CheckBox(); box.Text = "Show at startup"; box.FlatStyle = FlatStyle.Flat; box.Size = new System.Drawing.Size(95, 17); box.TabStop = false; box.Checked = true; box.CheckedChanged += new EventHandler(this.TaskPaneShowAtStartup); containerItem.Control = box; } else if (item.Name == "dockTaskList") { } else if (item.Name == "dockSearchResults") { // Just add the list box as a example... DockContainerItem dockItem = item as DockContainerItem; ListBox listbox = new ListBox(); // This will set the minimum size for the DockContainerItem listbox.Size = new Size(32, 32); // Must let the DockContainerItem resize it at will... listbox.IntegralHeight = false; dockItem.Control = listbox; } }
public void AddTab(UserControl ctrl, string name) { try { PanelDockContainer pdc = new PanelDockContainer(); pdc.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; pdc.Location = new System.Drawing.Point(3, 28); pdc.Name = "CONTROLID" + bar5.Items.Count.ToString(); pdc.Size = new System.Drawing.Size(553, 265); pdc.Style.Alignment = System.Drawing.StringAlignment.Center; pdc.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; pdc.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; pdc.Style.GradientAngle = 90; pdc.TabIndex = 2; ctrl.Dock = DockStyle.Fill; pdc.Controls.Add(ctrl); DockContainerItem dci = new DockContainerItem(); dci.Control = pdc; // ho.AddProperty(props, dci, pdc, proj); dci.Name = "TAB" + bar5.Items.Count.ToString(); pdc.Tag = dci; dci.Text = name; bar5.Controls.Add(pdc); bar5.Items.Add(dci); bar5.SelectedDockContainerItem = dci; dci.Tag = ctrl; } catch { } }
public DevComponents.DotNetBar.DockContainerItem CreateDockContainerItem(string ItemName, string ItemText, DevComponents.DotNetBar.PanelDockContainer panelDockContainer, DevComponents.DotNetBar.Bar bar) { DevComponents.DotNetBar.DockContainerItem dockContainerItem = new DockContainerItem(); dockContainerItem.Control = panelDockContainer; dockContainerItem.Name = ItemName; dockContainerItem.Text = ItemText; bar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { dockContainerItem }); return(dockContainerItem); }
private void BarMainContainer_DockTabClosed(object sender, DockTabClosingEventArgs e) { DockContainerItem item = e.DockContainerItem; if (this.barMainContainer.Items.Contains(item.Name)) this.barMainContainer.Items.Remove(item); if (item.Tag is BaseFormBusiness) { (item.Tag as BaseFormBusiness).ExecCloseWindowAfter(item.Tag, null); } ShowPreviousFrom(); }
/// <summary> /// 创建DockContainerItem(只考虑一个基地的情况) /// </summary> /// <param name="name"></param> /// <param name="text"></param> private DockContainerItem CreateDockContainerItem(string name, string text) { var dockItem = new DockContainerItem(); //dockItem.Control = this.pa; dockItem.Name = name; dockItem.Text = text; this.bar5.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { dockItem }); return(dockItem); }
private void AddDockContainerItem(string fileNum, string fullName, string patientGUID) { if (_isFirst) { dockContainerItem1.Name = fileNum; dockContainerItem1.Text = string.Format("{0} - {1}", fileNum, fullName); dockContainerItem1.Visible = true; if (panelDockContainer1.Controls.Count <= 0) { uPatient ctrl = new uPatient(); ctrl.PatientRow = _patientRow; panelDockContainer1.Tag = patientGUID; panelDockContainer1.Controls.Add(ctrl); ctrl.Dock = DockStyle.Fill; ctrl.DisplayInfo(); } else { panelDockContainer1.Tag = patientGUID; uPatient ctrl = panelDockContainer1.Controls[0] as uPatient; ctrl.PatientRow = _patientRow; ctrl.DisplayInfo(); } _isFirst = false; } else { DockContainerItem item = new DockContainerItem(fileNum, string.Format("{0} - {1}", fileNum, fullName)); PanelDockContainer p = new PanelDockContainer(); p.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Windows7; p.Style.Alignment = System.Drawing.StringAlignment.Center; p.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; p.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; p.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; p.Style.GradientAngle = 90; p.Tag = patientGUID; uPatient ctrl = new uPatient(); ctrl.PatientRow = _patientRow; p.Controls.Add(ctrl); ctrl.Dock = DockStyle.Fill; ctrl.DisplayInfo(); docBar.Controls.Add(p); item.Control = p; docBar.Items.Add(item); item.Selected = true; } }
private void CreateForms(string name, string strnamespace, string FilePath) { try { bool isBar = false; for (int i = 0; i < bar3.Items.Count; i++) { if (!bar3.Visible) { bar3.Visible = true; } string str = bar3.Items[i].Text; if (str == name) { bar3.Items[i].Visible = true; bar3.SelectedDockTab = i; bar3.Refresh(); isBar = true; break; } } if (!isBar) { Assembly outerAsm = Assembly.LoadFrom(FilePath); Type outerForm = outerAsm.GetType(strnamespace, false); Form fm = Activator.CreateInstance(outerForm) as Form; fm.Text = name; fm.TopLevel = false; fm.Dock = DockStyle.Fill; DockContainerItem item = null; PanelDockContainer panel = new PanelDockContainer(); item = new DockContainerItem(); item.CanClose = eDockContainerClose.Yes; item.Control = panel; item.Text = name; panel.Dock = DockStyle.Fill; panel.Controls.Add(fm); bar3.Items.Add(item); fm.Show(); bar3.SelectedDockContainerItem = item; } } catch (Exception e) { MessageBox.Show("创建窗体失败!" + e.ToString()); } }
//子窗体关闭事件 void item_VisibleChanged(object sender, EventArgs e) { DockContainerItem item = (DockContainerItem)sender; if (item.Visible == false) { try { this.barMainContainer.Items.Remove(item); //Form form = (Form)item.Control; //form.Dispose(); if (item.Tag is BaseFormBusiness) { (item.Tag as BaseFormBusiness).ExecCloseWindowAfter(item.Tag, null); } } catch { } } }
public void AddAsTab(string name, Bar bar) { var i = new DockContainerItem(name); i.Text = name; var panel = new PanelDockContainer(); panel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; panel.DisabledBackColor = System.Drawing.Color.Empty; panel.Location = new System.Drawing.Point(3, 28); panel.Name = name + "Container"; panel.Size = new System.Drawing.Size(688, 234); panel.Style.Alignment = System.Drawing.StringAlignment.Center; panel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; panel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; panel.Style.GradientAngle = 90; panel.Dock = DockStyle.Fill; i.Control = panel; bar.Controls.Add(panel); bar.Items.Add(i); }
private void ContainerLoadControl(object sender, System.EventArgs e) { BaseItem item = sender as BaseItem; if (item == null) { return; } if (item.Name == "cTaskShowatstartup") { ControlContainerItem containerItem = item as ControlContainerItem; CheckBox box = new CheckBox(); box.Text = "Show at startup"; box.FlatStyle = FlatStyle.Flat; box.Size = new System.Drawing.Size(95, 17); box.TabStop = false; box.Checked = true; box.CheckedChanged += new EventHandler(this.TaskPaneShowAtStartup); containerItem.Control = box; } else if (item.Name == "dockTaskList") { // See DefinitionLoaded event handler for Customize menu assignment for the bar that is containing this dock item DockContainerItem dockItem = item as DockContainerItem; dockItem.Control = new TaskList(); // Setting Displayed property for DockContainerItem will make sure that its tab is displayed first dockItem.Displayed = true; } else if (item.Name == "dockSearchResults") { // Just add the list box as a example... DockContainerItem dockItem = item as DockContainerItem; ListBox listbox = new ListBox(); // This will set the minimum size for the DockContainerItem listbox.Size = new Size(32, 32); // Must let the DockContainerItem resize it at will... listbox.IntegralHeight = false; dockItem.Control = listbox; } }
private void CreateBottomBarAutoHide() { Bar bar = new Bar("Bottom Bar in auto-hide state"); bar.Name = "bottomBar"; bar.LayoutType = eLayoutType.DockContainer; // Dock Container Layout needed for dockable windows bar.Stretch = true; // Dockable windows stretch to fill container bar.AutoHideAnimationTime = 0; // Some controls do not support animation so turn it off bar.GrabHandleStyle = eGrabHandleStyle.Caption; // Dockable Windows have captions dotNetBarManager1.Bars.Add(bar); // DotNetBar needs to be aware of the bar so it can manage it's docking etc. // Create hosted controls DockContainerItem dockItem = new DockContainerItem("bottomDockItem1", "First dock item"); bar.Items.Add(dockItem); // Create control that we want to host on dockable window UserControl1 dockedControl = new UserControl1(); dockedControl.label1.Text = bar.Name + " - " + dockItem.Text; dockedControl.BackColor = Color.Azure; dockItem.Control = dockedControl; // Specify that control is hosted on the dock container dockItem.Height = 128; // Specify the height of the dockable container and at the same time control // Create second dock container and add it to the bar dockItem = new DockContainerItem("bottomDockItem2", "Second dock item"); bar.Items.Add(dockItem); dockedControl = new UserControl1(); dockedControl.label1.Text = bar.Name + " - " + dockItem.Text; dockedControl.BackColor = Color.Aquamarine; dockItem.Control = dockedControl; // Specify that control is hosted on the dock container // Dock bar to bottom dock site dotNetBarManager1.BottomDockSite.GetDocumentUIManager().Dock(bar); dockItem.Height = 128; // Specify the height of the dockable container and at the same time control bar.RecalcLayout(); // Apply all changes... bar.AutoHide = true; // Place bar in auto-hide mode. Bar needs to be docked before it can be places in auto-hide mode }
public void CreateNewDocument(string formname, string formtext, object controlname) { foreach (DockContainerItem item in bar1.Items) { if (item.Name == formname) { bar1.SelectedDockContainerItem = item; return; } } // Create new DockContainerItem with the edit control and add it to the barDocuments DockContainerItem document = new DockContainerItem(formname, formtext); // Create control to host inside of new document document.Control = CreateForms.CreateNewDocumentControl(controlname.ToString()); bar1.Items.Add(document); if (!bar1.Visible) { bar1.Visible = true; } bar1.SelectedDockTab = bar1.Items.IndexOf(document); bar1.RecalcLayout(); }
/// <summary> /// 添加一个可停靠面板 /// </summary> /// <param name="dockPanel">可停靠面板</param> public void AddDockPanel(ICSRDock dockPanel) { DockContainerItem dockContainerItem = new DockContainerItem( generatNewDockContainerItemName(), dockPanel.PanelTitle); dockContainerItem.Control = dockPanel.Panel; dockContainerItem.CanClose = eDockContainerClose.Yes; switch (dockPanel.DefaultDock) { case DockStyle.Left: //停靠左侧面板 MainRibbonForm.barDockLeft.Controls.Add(dockPanel.Panel); MainRibbonForm.barDockLeft.Items.Add(dockContainerItem); MainRibbonForm.barDockLeft.Text = dockPanel.PanelTitle; MainRibbonForm.barDockLeft.SelectedDockContainerItem = dockContainerItem; MainRibbonForm.barDockLeft.DockTabClosed += BarDockLeft_DockTabClosed; if (!MainRibbonForm.barDockLeft.Visible) { MainRibbonForm.barDockLeft.Visible = true; } else { MainRibbonForm.barDockLeft.RecalcLayout(); } break; case DockStyle.Right: //停靠右侧面板 MainRibbonForm.barDockRight.Controls.Add(dockPanel.Panel); MainRibbonForm.barDockRight.Items.Add(dockContainerItem); MainRibbonForm.barDockRight.Text = dockPanel.PanelTitle; MainRibbonForm.barDockRight.SelectedDockContainerItem = dockContainerItem; MainRibbonForm.barDockRight.DockTabClosed += BarDockRight_DockTabClosed; if (!MainRibbonForm.barDockRight.Visible) { MainRibbonForm.barDockRight.Visible = true; } else { MainRibbonForm.barDockRight.RecalcLayout(); } break; case DockStyle.Bottom: //停靠底部面板 MainRibbonForm.barDockBottom.Controls.Add(dockPanel.Panel); MainRibbonForm.barDockBottom.Items.Add(dockContainerItem); MainRibbonForm.barDockBottom.Text = dockPanel.PanelTitle; MainRibbonForm.barDockBottom.SelectedDockContainerItem = dockContainerItem; MainRibbonForm.barDockBottom.DockTabClosed += BarDockBottom_DockTabClosed; if (!MainRibbonForm.barDockBottom.Visible) { MainRibbonForm.barDockBottom.Visible = true; } else { MainRibbonForm.barDockBottom.RecalcLayout(); } break; case DockStyle.Fill: //停靠中间面板 MainRibbonForm.barDockCenter.Controls.Add(dockPanel.Panel); MainRibbonForm.barDockCenter.Items.Add(dockContainerItem); MainRibbonForm.barDockCenter.Text = dockPanel.PanelTitle; MainRibbonForm.barDockCenter.SelectedDockContainerItem = dockContainerItem; MainRibbonForm.barDockCenter.DockTabClosed += BarDockCenter_DockTabClosed; if (!MainRibbonForm.barDockCenter.Visible) { MainRibbonForm.barDockCenter.Visible = true; } else { MainRibbonForm.barDockCenter.RecalcLayout(); } break; } }
public void BindTo(DockContainerItem item) { Dock = DockStyle.Fill; (item.Control as PanelDockContainer).Controls.Add(this); }
//打开首页 public void ShowForm(Form form, string menuName, string menuId) { int index = this.barMainContainer.Items.IndexOf(menuId); if (index < 0) { if (form != null) { //List<DockContainerItem> listitem = new List<DockContainerItem>(); //CloseTab delegateCloseTable = delegate() //{ // foreach (DockContainerItem item in listitem) // barMainContainer.CloseDockTab(item); //}; barMainContainer.BeginInit(); int displayWay = CustomConfigManager.GetDisplayWay();//显示方式 0 标准 1全屏 if (displayWay == 1) { form.Dock = DockStyle.Fill; } form.Size = new Size(1000, 600); form.FormBorderStyle = FormBorderStyle.None; form.TopLevel = false; if (this.barMainContainer.Width > form.Width) { form.Location = new Point((barMainContainer.Width - form.Width) / 2, 0); } else { form.Location = new Point(0, 0); } form.Show(); PanelDockContainer panelDockMain = new PanelDockContainer(); panelDockMain.Dock = DockStyle.Fill; panelDockMain.Controls.Add(form); panelDockMain.Location = new System.Drawing.Point(3, 28); panelDockMain.Style.Alignment = System.Drawing.StringAlignment.Center; panelDockMain.Style.GradientAngle = 90; panelDockMain.BackColor = Color.FromArgb(227, 239, 255); panelDockMain.AutoScroll = true; DockContainerItem item = new DockContainerItem(form.Text); item.Text = menuName; item.Name = menuId; item.Control = panelDockMain; item.Visible = true; item.Tag = form;//绑定界面对象 //item.Image = GetButtonImage(btnImage); //listitem.Add(item); item.VisibleChanged += new EventHandler(item_VisibleChanged); //this.barMainContainer.Controls.Add(panelDockMain); this.barMainContainer.Items.Add(item); this.barMainContainer.SelectedDockContainerItem = item; barMainContainer.EndInit(); this.barMainContainer.Show(); if (form is BaseFormBusiness) { (form as BaseFormBusiness).ExecOpenWindowBefore(form, null); } } } else { this.barMainContainer.SelectedDockContainerItem = (DockContainerItem)this.barMainContainer.Items[index]; string formname = ((DockContainerItem)this.barMainContainer.Items[index]).Tag.GetType().Name; if (formname == "FrmWebBrowser") { IfrmWebBrowserView webbrowser = (IfrmWebBrowserView)((DockContainerItem)this.barMainContainer.Items[index]).Tag; webbrowser.NavigateUrl();//重新加载网址 } } }
public void createEditorTab(string Location) { ScintillaNet.Scintilla scintilla = new ScintillaNet.Scintilla(); scintilla.Caret.BlinkRate = 500; if (Location.ToLower().EndsWith(".java")) { scintilla.ConfigurationManager.CustomLocation = "C:\\Program Files\\Bukkit Plugin Writer\\code highlighting.xml"; scintilla.ConfigurationManager.Language = "java"; } else if (Location.ToLower().EndsWith(".yml") || Location.ToLower().EndsWith(".yaml")) { scintilla.ConfigurationManager.Language = "yaml"; } scintilla.Dock = System.Windows.Forms.DockStyle.Fill; scintilla.Folding.IsEnabled = false; scintilla.Indentation.TabWidth = 4; scintilla.Indentation.UseTabs = false; scintilla.Location = new System.Drawing.Point(0, 0); scintilla.Margins.Margin0.Width = 20; scintilla.Margins.Margin2.IsClickable = false; scintilla.Margins.Margin2.IsFoldMargin = false; scintilla.Name = "scintilla1"; scintilla.Printing.PageSettings.Color = false; scintilla.Size = new System.Drawing.Size(377, 147); scintilla.Styles.Bits = 5; scintilla.Styles.BraceBad.FontName = "Verdana"; scintilla.Styles.BraceLight.FontName = "Verdana"; scintilla.Styles.ControlChar.FontName = "Verdana"; scintilla.Styles.Default.FontName = "Verdana"; scintilla.Styles.IndentGuide.FontName = "Verdana"; scintilla.Styles.LastPredefined.FontName = "Verdana"; scintilla.Styles.LineNumber.FontName = "Verdana"; scintilla.Styles.Max.FontName = "Verdana"; scintilla.TabIndex = 0; scintilla.KeyPress += new KeyPressEventHandler(scintilla_KeyPress); DockContainerItem tab = new DockContainerItem(); PanelDockContainer container = new PanelDockContainer(); tab.Control = container; bar4.Items.Add(tab); container.Controls.Add(scintilla); tab.Text = "New File"; if (Location != "") { if (System.IO.File.Exists(Location)) { System.IO.StreamReader reader = new System.IO.StreamReader(Location); scintilla.Text = reader.ReadToEnd(); scintilla.Tag = Location; reader.Close(); tab.Text = Location.Split('\\')[Location.Split('\\').Count() - 1]; int i = 0; foreach (DockContainerItem tabb in bar4.Items) { if (tabb == tab) { break; } else { i++; } } bar4.SelectedDockTab = i; } } }
private void BarHistory_DockTabChange(object sender, DockTabChangeEventArgs e) { DockContainerItem dockItemHistoryData = e.NewTab as DockContainerItem; if (dockItemHistoryData.Control.Controls.Count != 0) { return; } if (LayerList.Count == 0) { return; } frmArcgisMapControl newFrm = new frmArcgisMapControl(); for (int j = LayerList.Count - 1; j >= 0; j--) { IFeatureLayer layTemp = LayerList[j] as IFeatureLayer; IFeatureLayer pFeatureLayer = new FeatureLayerClass(); if (layTemp.FeatureClass.FeatureType == esriFeatureType.esriFTAnnotation) { pFeatureLayer = new FDOGraphicsLayerClass(); } else { (pFeatureLayer as IGeoFeatureLayer).Renderer = (layTemp as IGeoFeatureLayer).Renderer; } pFeatureLayer.FeatureClass = layTemp.FeatureClass; pFeatureLayer.Name = (layTemp.FeatureClass as IDataset).Name; IFeatureLayerDefinition featLayDefRes = null; if (m_Sel) { int fdIndex = layTemp.FeatureClass.Fields.FindField("SourceOID"); if (fdIndex == -1) { continue; } IFeatureLayerDefinition featLayDefTemp = layTemp as IFeatureLayerDefinition; IEnumIDs pEnumIDs = featLayDefTemp.DefinitionSelectionSet.IDs; int ID = pEnumIDs.Next(); StringBuilder sb = new StringBuilder(); while (ID != -1) { IFeature pFeat = layTemp.FeatureClass.GetFeature(ID); if (sb.Length != 0) { sb.Append(","); } sb.Append(pFeat.get_Value(fdIndex).ToString()); ID = pEnumIDs.Next(); } IQueryFilter queryFilter = new QueryFilterClass(); queryFilter.WhereClause = "SourceOID in (" + sb.ToString() + ")"; IFeatureSelection featSel = pFeatureLayer as IFeatureSelection; featSel.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, false); featSel.SelectionChanged(); IFeatureLayerDefinition featLayDef = pFeatureLayer as IFeatureLayerDefinition; IFeatureLayer selFeatLay = featLayDef.CreateSelectionLayer(pFeatureLayer.Name, true, "", ""); IGeoFeatureLayer pGeoFeatureLayer = layTemp as IGeoFeatureLayer; if (pGeoFeatureLayer != null) { (selFeatLay as IGeoFeatureLayer).Renderer = pGeoFeatureLayer.Renderer; } newFrm.ArcGisMapControl.Map.AddLayer(selFeatLay); featLayDefRes = selFeatLay as IFeatureLayerDefinition; } else { newFrm.ArcGisMapControl.Map.AddLayer(pFeatureLayer); featLayDefRes = pFeatureLayer as IFeatureLayerDefinition; } featLayDefRes.DefinitionExpression = "FromDate<='" + dockItemHistoryData.Text + "' and ToDate>'" + dockItemHistoryData.Text + "'"; } newFrm.ArcGisMapControl.ActiveView.Extent = ArcGisMapControl.ActiveView.Extent; newFrm.ArcGisMapControl.Refresh(); newFrm.ArcGisMapControl.Dock = DockStyle.Fill; dockItemHistoryData.Control.Controls.Add(newFrm.ArcGisMapControl); LstArcGisMapControl.Add(newFrm.ArcGisMapControl); }
private void CreateLeftDockedBars() { // Dock first two bars side by side and dock third bar next to them... Bar bar = new Bar("Bar1"); bar.Name = "leftBar1"; bar.LayoutType = eLayoutType.DockContainer; // Dock Container Layout needed for dockable windows bar.Stretch = true; // Dockable windows stretch to fill container bar.AutoHideAnimationTime = 0; // Some controls do not support animation so turn it off bar.GrabHandleStyle = eGrabHandleStyle.Caption; // Dockable Windows have captions bar.CanHide = true; // Create DockContainerItem for the bar. The item should be added before the bar is docked. DockContainerItem dockItem = new DockContainerItem("leftDockItem1", "Top Left Dock Container"); bar.Items.Add(dockItem); // Create control that is hosted on dock container UserControl1 dockedControl = new UserControl1(); dockedControl.label1.Text = bar.Name + " - " + dockItem.Text; dockedControl.BackColor = Color.Khaki; dockItem.Control = dockedControl; // Specify that control is hosted on the dock container dotNetBarManager1.Bars.Add(bar); // DotNetBar needs to be aware of the bar so it can manage it's docking etc. dotNetBarManager1.LeftDockSite.GetDocumentUIManager().Dock(bar); //Performs actual docking of the Bar to the specified dock site dockItem.Width = 128; // Specify Width of dock container item after it is docked // Create second bar and dock it below the first bar but still on the same line Bar bar2 = new Bar("Bar2"); bar2.Name = "leftBar2"; bar2.LayoutType = eLayoutType.DockContainer; // Dock Container Layout needed for dockable windows bar2.AutoHideAnimationTime = 0; // Some controls do not support animation so turn it off bar2.Stretch = true; // Dockable windows stretch to fill container bar2.CanHide = true; bar2.GrabHandleStyle = eGrabHandleStyle.Caption; // Dockable Windows have captions // Add new Dock Container to the bar, should be done before adding the bar so size can be calculated properly dockItem = new DockContainerItem("leftDockItem2", "Bottom Left Dock Container"); bar2.Items.Add(dockItem); // Create control that is hosted on dock container dockedControl = new UserControl1(); dockedControl.label1.Text = bar.Name + " - " + dockItem.Text; dockedControl.BackColor = Color.Lavender; dockItem.Control = dockedControl; // Specify that control is hosted on the dock container dotNetBarManager1.Bars.Add(bar2); // DotNetBar needs to be aware of the bar so it can manage it's docking etc. dotNetBarManager1.LeftDockSite.GetDocumentUIManager().Dock(bar, bar2, eDockSide.Bottom); // Dock new bar2 below the bar that we created previously // Create third bar that is docked next to the first and second // i.e. on the line 1 bar = new Bar("Bar3"); bar.Name = "leftBar3"; bar.LayoutType = eLayoutType.DockContainer; // Dock Container Layout needed for dockable windows bar.AutoHideAnimationTime = 0; // Some controls do not support animation so turn it off bar.Stretch = true; // Dockable windows stretch to fill container bar.CanHide = true; bar.GrabHandleStyle = eGrabHandleStyle.Caption; // Dockable Windows have captions dockItem = new DockContainerItem("leftDockItem3", "Left Dock Container line 1"); bar.Items.Add(dockItem); // Create control that is hosted on dock container dockedControl = new UserControl1(); dockedControl.label1.Text = bar.Name + " - " + dockItem.Text; dockedControl.BackColor = Color.LemonChiffon; dockItem.Control = dockedControl; // Specify that control is hosted on the dock container dotNetBarManager1.Bars.Add(bar); // DotNetBar needs to be aware of the bar so it can manage it's docking etc. dotNetBarManager1.LeftDockSite.GetDocumentUIManager().Dock(bar); // Setting the width of the dock site will also scale the bars docked inside, // however the size should be large enough to accomodate all bars including the constraints like MinimumSize etc. dotNetBarManager1.LeftDockSite.Width = 150; }
protected override void OnDragOver(DragEventArgs de) { if(m_DragInProgress) { Point p=this.Control.PointToClient(new Point(de.X,de.Y)); MouseDragOver(p.X,p.Y); de.Effect=DragDropEffects.Move; return; } if(m_EnableItemDragDrop && m_AcceptExternalControls && !this.IsDockableWindow) { ISelectionService sel=(ISelectionService)this.GetService(typeof(ISelectionService)); if(sel!=null && sel.PrimarySelection!=this.Component) { if(sel.PrimarySelection is Control && this.Control.Controls.Contains((Control)sel.PrimarySelection)) { BaseItem item=GetControlItem(sel.PrimarySelection as Control); if(item!=null) { m_MouseDownPoint=this.Control.PointToClient(new Point(de.X,de.Y)); m_SuspendInternalCursor=true; StartItemDrag(item); if(m_TimerDragDrop==null) { m_TimerDragDrop=new Timer(); m_TimerDragDrop.Tick+=new EventHandler(this.TimerTickDragDrop); m_TimerDragDrop.Interval=100; m_TimerDragDrop.Enabled=true; m_TimerDragDrop.Start(); } } return; } else if(sel.SelectionCount>1) { de.Effect=DragDropEffects.None; return; } else if(sel.PrimarySelection is Control && ((Control)sel.PrimarySelection).Parent!=null) { // New control being added to the container BaseItem dragItem=null; if(this.IsDockableWindow) { DockContainerItem dc=new DockContainerItem(); dc.Name=TEMP_NAME; //dc.Control=sel.PrimarySelection as System.Windows.Forms.Control; dragItem=dc; } else { ControlContainerItem cc=new ControlContainerItem(); cc.AllowItemResize = false; cc.Name=TEMP_NAME; //cc.Control=sel.PrimarySelection as System.Windows.Forms.Control; dragItem=cc; } m_MouseDownPoint=this.Control.PointToClient(new Point(de.X,de.Y)); m_SuspendInternalCursor=true; StartItemDrag(dragItem); if (m_TimerDragDrop == null) { m_TimerDragDrop = new Timer(); m_TimerDragDrop.Tick += new EventHandler(this.TimerTickDragDrop); m_TimerDragDrop.Interval = 100; m_TimerDragDrop.Enabled = true; m_TimerDragDrop.Start(); } } } } base.OnDragOver (de); }
private void btnOk_Click(object sender, EventArgs e) { if (listViewEx.CheckedItems.Count == 0) { return; } LayerList = new List <ILayer>(); for (int i = 0; i < Mapcontrol.Map.LayerCount; i++) { //IFeatureLayer featLay = Mapcontrol.Map.get_Layer(i) as IFeatureLayer; //changed by xisheng 20110828 ILayer mLayer = Mapcontrol.Map.get_Layer(i); if (mLayer is IGroupLayer) { ICompositeLayer pComLayer = mLayer as ICompositeLayer; for (int j = 0; j < pComLayer.Count; j++) { IFeatureLayer featLay = pComLayer.get_Layer(j) as IFeatureLayer; if (featLay == null) { continue; } if (!(featLay.FeatureClass as IDataset).Name.EndsWith("_GOH")) { continue; } LayerList.Add(featLay); } } else { IFeatureLayer featLay = Mapcontrol.Map.get_Layer(i) as IFeatureLayer; if (featLay == null) { continue; } if (!(featLay.FeatureClass as IDataset).Name.EndsWith("_GOH")) { continue; } LayerList.Add(featLay); } } LstArcGisMapControl = new List <AxMapControl>(); BarHistory.Items["dockItemHistoryData0"].Text = listViewEx.CheckedItems[0].Text; BarHistory.Items["dockItemHistoryData0"].Tooltip = listViewEx.CheckedItems[0].Text; ESRI.ArcGIS.Controls.AxMapControl axMapControlHistoryData = (BarHistory.Items["dockItemHistoryData0"] as DockContainerItem).Control.Controls[0] as AxMapControl; LstArcGisMapControl.Add(axMapControlHistoryData); for (int i = LayerList.Count - 1; i >= 0; i--) { IFeatureLayer layTemp = LayerList[i] as IFeatureLayer; IFeatureLayer pFeatureLayer = new FeatureLayerClass(); if (layTemp.FeatureClass.FeatureType == esriFeatureType.esriFTAnnotation) { pFeatureLayer = new FDOGraphicsLayerClass(); } else { (pFeatureLayer as IGeoFeatureLayer).Renderer = (layTemp as IGeoFeatureLayer).Renderer; } pFeatureLayer.FeatureClass = layTemp.FeatureClass; pFeatureLayer.Name = (layTemp.FeatureClass as IDataset).Name; IFeatureLayerDefinition featLayDefRes = null; if (m_Sel) { int fdIndex = layTemp.FeatureClass.Fields.FindField("SourceOID"); if (fdIndex == -1) { continue; } IFeatureLayerDefinition featLayDefTemp = layTemp as IFeatureLayerDefinition; IEnumIDs pEnumIDs = featLayDefTemp.DefinitionSelectionSet.IDs; int ID = pEnumIDs.Next(); StringBuilder sb = new StringBuilder(); while (ID != -1) { IFeature pFeat = layTemp.FeatureClass.GetFeature(ID); if (sb.Length != 0) { sb.Append(","); } sb.Append(pFeat.get_Value(fdIndex).ToString()); ID = pEnumIDs.Next(); } IQueryFilter queryFilter = new QueryFilterClass(); queryFilter.WhereClause = "SourceOID in (" + sb.ToString() + ")"; IFeatureSelection featSel = pFeatureLayer as IFeatureSelection; featSel.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, false); featSel.SelectionChanged(); IFeatureLayerDefinition featLayDef = pFeatureLayer as IFeatureLayerDefinition; IFeatureLayer selFeatLay = featLayDef.CreateSelectionLayer(pFeatureLayer.Name, true, "", ""); IGeoFeatureLayer pGeoFeatureLayer = layTemp as IGeoFeatureLayer; if (pGeoFeatureLayer != null) { (selFeatLay as IGeoFeatureLayer).Renderer = pGeoFeatureLayer.Renderer; } axMapControlHistoryData.Map.AddLayer(selFeatLay); featLayDefRes = selFeatLay as IFeatureLayerDefinition; } else { axMapControlHistoryData.Map.AddLayer(pFeatureLayer); featLayDefRes = pFeatureLayer as IFeatureLayerDefinition; } featLayDefRes.DefinitionExpression = "FromDate<='" + listViewEx.CheckedItems[0].Text + "' and ToDate>'" + listViewEx.CheckedItems[0].Text + "'"; } axMapControlHistoryData.ActiveView.Extent = ArcGisMapControl.ActiveView.Extent; axMapControlHistoryData.ActiveView.Refresh(); for (int i = 1; i < listViewEx.CheckedItems.Count; i++) { DockContainerItem dockItemHistoryData = new DockContainerItem("dockItemHistoryData" + i.ToString(), listViewEx.CheckedItems[i].Text); dockItemHistoryData.Tooltip = listViewEx.CheckedItems[i].Text; PanelDockContainer PanelTipHistoryData = new PanelDockContainer(); dockItemHistoryData.Control = PanelTipHistoryData; BarHistory.Items.Add(dockItemHistoryData); } ArcGisMapControl.OnExtentUpdated += new IMapControlEvents2_Ax_OnExtentUpdatedEventHandler(ArcGisMapControl_OnExtentUpdated); ArcGisMapControl.OnViewRefreshed += new IMapControlEvents2_Ax_OnViewRefreshedEventHandler(ArcGisMapControl_OnViewRefreshed); this.Close(); }
public FrmJoinAttribute(AxMapControl mapcontrol, ILayer layer, DevComponents.DotNetBar.Bar barTable, DataTable AttributeTable, DevComponents.DotNetBar.Controls.DataGridViewX gridfield, DockContainerItem docktable) { InitializeComponent(); this.EnableGlass = false; pMapControl = mapcontrol; pLayer = layer; m_barTable = barTable; m_AttributeTable = AttributeTable; m_gridfield = gridfield; m_docktable = docktable; }
private void InitializeComponent() { this.components = new Container(); this.mdiClient1 = new MdiClient(); this.timer_send = new System.Windows.Forms.Timer(this.components); this.NetBarManager = new DotNetBarManager(this.components); this.dockSite4 = new DockSite(); this.bar1 = new Bar(); this.panelDockContainer1 = new PanelDockContainer(); this.syslogbox = new TextBox(); this.panelDockContainer2 = new PanelDockContainer(); this.dockContainerItem1 = new DockContainerItem(); this.dockContainerItem2 = new DockContainerItem(); this.dockSite1 = new DockSite(); this.dockSite2 = new DockSite(); this.dockSite8 = new DockSite(); this.dockSite5 = new DockSite(); this.dockSite6 = new DockSite(); this.dockSite7 = new DockSite(); this.dockSite3 = new DockSite(); this.tabStrip1 = new TabStrip(); this.dockSite4.SuspendLayout(); this.bar1.BeginInit(); this.bar1.SuspendLayout(); this.panelDockContainer1.SuspendLayout(); base.SuspendLayout(); this.mdiClient1.BackColor = Color.FromArgb(0xc2, 0xd9, 0xf7); this.mdiClient1.Dock = DockStyle.Fill; this.mdiClient1.Location = new Point(0, 0x1a); this.mdiClient1.Name = "mdiClient1"; this.mdiClient1.Size = new Size(0x265, 0x109); this.mdiClient1.TabIndex = 0x19; this.timer_send.Enabled = true; this.timer_send.Interval = 0x1388; this.timer_send.Tick += new EventHandler(this.timer_send_Tick); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.F1); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlC); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlA); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlV); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlX); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlZ); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlY); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.Del); this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.Ins); this.NetBarManager.BottomDockSite = this.dockSite4; this.NetBarManager.DefinitionName = ""; this.NetBarManager.EnableFullSizeDock = false; this.NetBarManager.LeftDockSite = this.dockSite1; this.NetBarManager.ParentForm = this; this.NetBarManager.RightDockSite = this.dockSite2; this.NetBarManager.Style = eDotNetBarStyle.Office2007; this.NetBarManager.ToolbarBottomDockSite = this.dockSite8; this.NetBarManager.ToolbarLeftDockSite = this.dockSite5; this.NetBarManager.ToolbarRightDockSite = this.dockSite6; this.NetBarManager.ToolbarTopDockSite = this.dockSite7; this.NetBarManager.TopDockSite = this.dockSite3; this.dockSite4.Controls.Add(this.bar1); this.dockSite4.Dock = DockStyle.Bottom; this.dockSite4.DocumentDockContainer = new DocumentDockContainer(new DocumentBaseContainer[] { new DocumentBarContainer(this.bar1, 0x265, 0x8f) }, eOrientation.Vertical); this.dockSite4.Location = new Point(0, 0x123); this.dockSite4.Name = "dockSite4"; this.dockSite4.Size = new Size(0x265, 0x92); this.dockSite4.TabIndex = 0x1d; this.dockSite4.TabStop = false; this.bar1.AccessibleDescription = "DotNetBar Bar (bar1)"; this.bar1.AccessibleName = "DotNetBar Bar"; this.bar1.AutoSyncBarCaption = true; this.bar1.CloseSingleTab = true; this.bar1.Controls.Add(this.panelDockContainer1); this.bar1.Controls.Add(this.panelDockContainer2); this.bar1.GrabHandleStyle = eGrabHandleStyle.Caption; this.bar1.Items.AddRange(new BaseItem[] { this.dockContainerItem1, this.dockContainerItem2 }); this.bar1.LayoutType = eLayoutType.DockContainer; this.bar1.Location = new Point(0, 3); this.bar1.Name = "bar1"; this.bar1.SelectedDockTab = 0; this.bar1.Size = new Size(0x265, 0x8f); this.bar1.Stretch = true; this.bar1.Style = eDotNetBarStyle.Office2007; this.bar1.TabIndex = 0; this.bar1.TabStop = false; this.bar1.Text = "日志"; this.panelDockContainer1.ColorSchemeStyle = eDotNetBarStyle.Office2007; this.panelDockContainer1.Controls.Add(this.syslogbox); this.panelDockContainer1.Location = new Point(3, 0x17); this.panelDockContainer1.Name = "panelDockContainer1"; this.panelDockContainer1.Size = new Size(0x25f, 0x5c); this.panelDockContainer1.Style.Alignment = StringAlignment.Center; this.panelDockContainer1.Style.BackColor1.ColorSchemePart = eColorSchemePart.BarBackground; this.panelDockContainer1.Style.BackColor2.ColorSchemePart = eColorSchemePart.BarBackground2; this.panelDockContainer1.Style.BorderColor.ColorSchemePart = eColorSchemePart.BarDockedBorder; this.panelDockContainer1.Style.ForeColor.ColorSchemePart = eColorSchemePart.ItemText; this.panelDockContainer1.Style.GradientAngle = 90; this.panelDockContainer1.TabIndex = 0; this.syslogbox.Dock = DockStyle.Fill; this.syslogbox.Location = new Point(0, 0); this.syslogbox.Multiline = true; this.syslogbox.Name = "syslogbox"; this.syslogbox.ScrollBars = ScrollBars.Vertical; this.syslogbox.Size = new Size(0x25f, 0x5c); this.syslogbox.TabIndex = 0; this.panelDockContainer2.ColorSchemeStyle = eDotNetBarStyle.Office2007; this.panelDockContainer2.Location = new Point(3, 0x17); this.panelDockContainer2.Name = "panelDockContainer2"; this.panelDockContainer2.Size = new Size(0x25f, 0x5c); this.panelDockContainer2.Style.Alignment = StringAlignment.Center; this.panelDockContainer2.Style.BackColor1.ColorSchemePart = eColorSchemePart.BarBackground; this.panelDockContainer2.Style.BackColor2.ColorSchemePart = eColorSchemePart.BarBackground2; this.panelDockContainer2.Style.BorderColor.ColorSchemePart = eColorSchemePart.BarDockedBorder; this.panelDockContainer2.Style.ForeColor.ColorSchemePart = eColorSchemePart.ItemText; this.panelDockContainer2.Style.GradientAngle = 90; this.panelDockContainer2.TabIndex = 2; this.dockContainerItem1.Control = this.panelDockContainer1; this.dockContainerItem1.Name = "dockContainerItem1"; this.dockContainerItem1.Text = "日志"; this.dockContainerItem2.Control = this.panelDockContainer2; this.dockContainerItem2.Name = "dockContainerItem2"; this.dockContainerItem2.Text = "系统"; this.dockSite1.Dock = DockStyle.Left; this.dockSite1.DocumentDockContainer = new DocumentDockContainer(); this.dockSite1.Location = new Point(0, 0); this.dockSite1.Name = "dockSite1"; this.dockSite1.Size = new Size(0, 0x123); this.dockSite1.TabIndex = 0x1a; this.dockSite1.TabStop = false; this.dockSite2.Dock = DockStyle.Right; this.dockSite2.DocumentDockContainer = new DocumentDockContainer(); this.dockSite2.Location = new Point(0x265, 0); this.dockSite2.Name = "dockSite2"; this.dockSite2.Size = new Size(0, 0x123); this.dockSite2.TabIndex = 0x1b; this.dockSite2.TabStop = false; this.dockSite8.Dock = DockStyle.Bottom; this.dockSite8.Location = new Point(0, 0x1b5); this.dockSite8.Name = "dockSite8"; this.dockSite8.Size = new Size(0x265, 0); this.dockSite8.TabIndex = 0x21; this.dockSite8.TabStop = false; this.dockSite5.Dock = DockStyle.Left; this.dockSite5.Location = new Point(0, 0); this.dockSite5.Name = "dockSite5"; this.dockSite5.Size = new Size(0, 0x1b5); this.dockSite5.TabIndex = 30; this.dockSite5.TabStop = false; this.dockSite6.Dock = DockStyle.Right; this.dockSite6.Location = new Point(0x265, 0); this.dockSite6.Name = "dockSite6"; this.dockSite6.Size = new Size(0, 0x1b5); this.dockSite6.TabIndex = 0x1f; this.dockSite6.TabStop = false; this.dockSite7.Dock = DockStyle.Top; this.dockSite7.Location = new Point(0, 0); this.dockSite7.Name = "dockSite7"; this.dockSite7.Size = new Size(0x265, 0); this.dockSite7.TabIndex = 0x20; this.dockSite7.TabStop = false; this.dockSite3.Dock = DockStyle.Top; this.dockSite3.DocumentDockContainer = new DocumentDockContainer(); this.dockSite3.Location = new Point(0, 0); this.dockSite3.Name = "dockSite3"; this.dockSite3.Size = new Size(0x265, 0); this.dockSite3.TabIndex = 0x1c; this.dockSite3.TabStop = false; this.tabStrip1.AutoSelectAttachedControl = true; this.tabStrip1.CanReorderTabs = true; this.tabStrip1.CloseButtonVisible = false; this.tabStrip1.Dock = DockStyle.Top; this.tabStrip1.Location = new Point(0, 0); this.tabStrip1.MdiTabbedDocuments = true; this.tabStrip1.Name = "tabStrip1"; this.tabStrip1.SelectedTab = null; this.tabStrip1.SelectedTabFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0); this.tabStrip1.Size = new Size(0x265, 0x1a); this.tabStrip1.Style = eTabStripStyle.Office2007Document; this.tabStrip1.TabAlignment = eTabStripAlignment.Top; this.tabStrip1.TabIndex = 0x22; this.tabStrip1.TabLayoutType = eTabLayoutType.MultilineWithNavigationBox; this.tabStrip1.Text = "tabStrip1"; base.AutoScaleDimensions = new SizeF(6f, 12f); base.ClientSize = new Size(0x265, 0x1b5); base.Controls.Add(this.tabStrip1); base.Controls.Add(this.dockSite2); base.Controls.Add(this.dockSite1); base.Controls.Add(this.dockSite3); base.Controls.Add(this.dockSite4); base.Controls.Add(this.dockSite5); base.Controls.Add(this.dockSite6); base.Controls.Add(this.dockSite7); base.Controls.Add(this.dockSite8); base.Controls.Add(this.mdiClient1); base.IsMdiContainer = true; base.Name = "main"; this.Text = "anyEncoder编码器"; base.FormClosed += new FormClosedEventHandler(this.main_FormClosed); base.Load += new EventHandler(this.main_Load); this.dockSite4.ResumeLayout(false); this.bar1.EndInit(); this.bar1.ResumeLayout(false); this.panelDockContainer1.ResumeLayout(false); this.panelDockContainer1.PerformLayout(); base.ResumeLayout(false); }
private void DockTabs(Bar sourceBar, int selectedTabIndex, Bar targetBar) { // Move Dock-container item to different bar IDesignerHost designerHost=this.GetService(typeof(IDesignerHost)) as IDesignerHost; DesignerTransaction trans=designerHost.CreateTransaction("DotNetBar Docking"); IComponentChangeService cc=(IComponentChangeService)GetService(typeof(IComponentChangeService)); try { DockContainerItem[] items=null; if(selectedTabIndex!=-1) items=new DockContainerItem[] {sourceBar.Items[sourceBar.SelectedDockTab] as DockContainerItem}; else { items=new DockContainerItem[sourceBar.Items.Count]; sourceBar.Items.CopyTo(items,0); } cc.OnComponentChanging(sourceBar,TypeDescriptor.GetProperties(typeof(Bar))["Controls"]); cc.OnComponentChanging(sourceBar,TypeDescriptor.GetProperties(typeof(Bar))["Items"]); sourceBar.Items.RemoveRange(items); cc.OnComponentChanged(sourceBar,TypeDescriptor.GetProperties(typeof(Bar))["Items"],null,null); cc.OnComponentChanged(sourceBar,TypeDescriptor.GetProperties(typeof(Bar))["Controls"],null,null); cc.OnComponentChanging(targetBar,TypeDescriptor.GetProperties(typeof(Bar))["Controls"]); cc.OnComponentChanging(targetBar,TypeDescriptor.GetProperties(typeof(Bar))["Items"]); targetBar.Items.AddRange(items); cc.OnComponentChanged(targetBar,TypeDescriptor.GetProperties(typeof(Bar))["Items"],null,null); cc.OnComponentChanged(targetBar,TypeDescriptor.GetProperties(typeof(Bar))["Controls"],null,null); if(sourceBar.Items.Count==0) { DockSite sourceDockSite=sourceBar.Parent as DockSite; cc.OnComponentChanging(sourceDockSite,TypeDescriptor.GetProperties(typeof(DockSite))["DocumentDockContainer"]); cc.OnComponentChanging(sourceBar,null); sourceDockSite.GetDocumentUIManager().UnDock(sourceBar,false); cc.OnComponentChanged(sourceBar,null,null,null); cc.OnComponentChanged(sourceDockSite,TypeDescriptor.GetProperties(typeof(DockSite))["DocumentDockContainer"],null,null); designerHost.DestroyComponent(sourceBar); } if(targetBar!=null && targetBar.SelectedDockTab>=0) { DockContainerItem dock=targetBar.Items[targetBar.SelectedDockTab] as DockContainerItem; if(dock!=null && dock.Control!=null) { cc.OnComponentChanged(targetBar,TypeDescriptor.GetProperties(typeof(Bar))["Controls"],null,null); dock.Control.BringToFront(); cc.OnComponentChanged(targetBar,TypeDescriptor.GetProperties(typeof(Bar))["Controls"],null,null); } } } catch { trans.Cancel(); throw; } finally { if(!trans.Canceled) trans.Commit(); } }