diff --git a/src/Libraries/DockPanel_Src/DockSample/DockSample.csproj b/src/Libraries/DockPanel_Src/DockSample/DockSample.csproj index 0a1cdbbe81..e0234e468a 100644 --- a/src/Libraries/DockPanel_Src/DockSample/DockSample.csproj +++ b/src/Libraries/DockPanel_Src/DockSample/DockSample.csproj @@ -41,6 +41,12 @@ AboutDialog.cs + + Form + + + MainForm2.cs + Form @@ -198,6 +204,10 @@ + + MainForm2.cs + Designer + ResXFileCodeGenerator Resources.Designer.cs diff --git a/src/Libraries/DockPanel_Src/DockSample/MainForm.cs b/src/Libraries/DockPanel_Src/DockSample/MainForm.cs index 57fe65352c..f9d0f3fd98 100644 --- a/src/Libraries/DockPanel_Src/DockSample/MainForm.cs +++ b/src/Libraries/DockPanel_Src/DockSample/MainForm.cs @@ -403,7 +403,7 @@ namespace DockSample } else { - foreach (IDockContent document in dockPanel.Documents) + foreach (IDockContent document in dockPanel.DocumentsToArray()) { if (!document.DockHandler.IsActivated) document.DockHandler.Close(); diff --git a/src/Libraries/DockPanel_Src/DockSample/MainForm2.Designer.cs b/src/Libraries/DockPanel_Src/DockSample/MainForm2.Designer.cs new file mode 100644 index 0000000000..073f668207 --- /dev/null +++ b/src/Libraries/DockPanel_Src/DockSample/MainForm2.Designer.cs @@ -0,0 +1,635 @@ +namespace DockSample +{ + partial class MainForm2 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm2)); + this.mainMenu = new System.Windows.Forms.MenuStrip(); + this.menuItemFile = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemNew = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemOpen = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemClose = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemCloseAll = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemCloseAllButThisOne = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItem4 = new System.Windows.Forms.ToolStripSeparator(); + this.menuItemExit = new System.Windows.Forms.ToolStripMenuItem(); + this.exitWithoutSavingLayout = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemView = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemSolutionExplorer = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemPropertyWindow = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemToolbox = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemOutputWindow = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemTaskList = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.menuItemToolBar = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemStatusBar = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.menuItemLayoutByCode = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemLayoutByXml = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemTools = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemLockLayout = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemShowDocumentIcon = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItem3 = new System.Windows.Forms.ToolStripSeparator(); + this.menuItemSchemaVS2005 = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemSchemaVS2003 = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItem6 = new System.Windows.Forms.ToolStripSeparator(); + this.menuItemDockingMdi = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemDockingSdi = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemDockingWindow = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemSystemMdi = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItem5 = new System.Windows.Forms.ToolStripSeparator(); + this.showRightToLeft = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemWindow = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemNewWindow = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemHelp = new System.Windows.Forms.ToolStripMenuItem(); + this.menuItemAbout = new System.Windows.Forms.ToolStripMenuItem(); + this.imageList = new System.Windows.Forms.ImageList(this.components); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.toolBar = new System.Windows.Forms.ToolStrip(); + this.toolBarButtonNew = new System.Windows.Forms.ToolStripButton(); + this.toolBarButtonOpen = new System.Windows.Forms.ToolStripButton(); + this.toolBarButtonSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.toolBarButtonSolutionExplorer = new System.Windows.Forms.ToolStripButton(); + this.toolBarButtonPropertyWindow = new System.Windows.Forms.ToolStripButton(); + this.toolBarButtonToolbox = new System.Windows.Forms.ToolStripButton(); + this.toolBarButtonOutputWindow = new System.Windows.Forms.ToolStripButton(); + this.toolBarButtonTaskList = new System.Windows.Forms.ToolStripButton(); + this.toolBarButtonSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.toolBarButtonLayoutByCode = new System.Windows.Forms.ToolStripButton(); + this.toolBarButtonLayoutByXml = new System.Windows.Forms.ToolStripButton(); + this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); + this.statusBar = new System.Windows.Forms.StatusStrip(); + this.mainMenu.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.toolBar.SuspendLayout(); + this.SuspendLayout(); + // + // mainMenu + // + this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuItemFile, + this.menuItemView, + this.menuItemTools, + this.menuItemWindow, + this.menuItemHelp}); + this.mainMenu.Location = new System.Drawing.Point(0, 0); + this.mainMenu.MdiWindowListItem = this.menuItemWindow; + this.mainMenu.Name = "mainMenu"; + this.mainMenu.Size = new System.Drawing.Size(579, 24); + this.mainMenu.TabIndex = 7; + // + // menuItemFile + // + this.menuItemFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuItemNew, + this.menuItemOpen, + this.menuItemClose, + this.menuItemCloseAll, + this.menuItemCloseAllButThisOne, + this.menuItem4, + this.menuItemExit, + this.exitWithoutSavingLayout}); + this.menuItemFile.Name = "menuItemFile"; + this.menuItemFile.Size = new System.Drawing.Size(35, 20); + this.menuItemFile.Text = "&File"; + this.menuItemFile.DropDownOpening += new System.EventHandler(this.menuItemFile_Popup); + // + // menuItemNew + // + this.menuItemNew.Name = "menuItemNew"; + this.menuItemNew.Size = new System.Drawing.Size(204, 22); + this.menuItemNew.Text = "&New"; + this.menuItemNew.Click += new System.EventHandler(this.menuItemNew_Click); + // + // menuItemOpen + // + this.menuItemOpen.Name = "menuItemOpen"; + this.menuItemOpen.Size = new System.Drawing.Size(204, 22); + this.menuItemOpen.Text = "&Open..."; + this.menuItemOpen.Click += new System.EventHandler(this.menuItemOpen_Click); + // + // menuItemClose + // + this.menuItemClose.Name = "menuItemClose"; + this.menuItemClose.Size = new System.Drawing.Size(204, 22); + this.menuItemClose.Text = "&Close"; + this.menuItemClose.Click += new System.EventHandler(this.menuItemClose_Click); + // + // menuItemCloseAll + // + this.menuItemCloseAll.Name = "menuItemCloseAll"; + this.menuItemCloseAll.Size = new System.Drawing.Size(204, 22); + this.menuItemCloseAll.Text = "Close &All"; + this.menuItemCloseAll.Click += new System.EventHandler(this.menuItemCloseAll_Click); + // + // menuItemCloseAllButThisOne + // + this.menuItemCloseAllButThisOne.Name = "menuItemCloseAllButThisOne"; + this.menuItemCloseAllButThisOne.Size = new System.Drawing.Size(204, 22); + this.menuItemCloseAllButThisOne.Text = "Close All &But This One"; + this.menuItemCloseAllButThisOne.Click += new System.EventHandler(this.menuItemCloseAllButThisOne_Click); + // + // menuItem4 + // + this.menuItem4.Name = "menuItem4"; + this.menuItem4.Size = new System.Drawing.Size(201, 6); + // + // menuItemExit + // + this.menuItemExit.Name = "menuItemExit"; + this.menuItemExit.Size = new System.Drawing.Size(204, 22); + this.menuItemExit.Text = "&Exit"; + this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click); + // + // exitWithoutSavingLayout + // + this.exitWithoutSavingLayout.Name = "exitWithoutSavingLayout"; + this.exitWithoutSavingLayout.Size = new System.Drawing.Size(204, 22); + this.exitWithoutSavingLayout.Text = "Exit &Without Saving Layout"; + this.exitWithoutSavingLayout.Click += new System.EventHandler(this.exitWithoutSavingLayout_Click); + // + // menuItemView + // + this.menuItemView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuItemSolutionExplorer, + this.menuItemPropertyWindow, + this.menuItemToolbox, + this.menuItemOutputWindow, + this.menuItemTaskList, + this.menuItem1, + this.menuItemToolBar, + this.menuItemStatusBar, + this.menuItem2, + this.menuItemLayoutByCode, + this.menuItemLayoutByXml}); + this.menuItemView.MergeIndex = 1; + this.menuItemView.Name = "menuItemView"; + this.menuItemView.Size = new System.Drawing.Size(41, 20); + this.menuItemView.Text = "&View"; + // + // menuItemSolutionExplorer + // + this.menuItemSolutionExplorer.Name = "menuItemSolutionExplorer"; + this.menuItemSolutionExplorer.Size = new System.Drawing.Size(176, 22); + this.menuItemSolutionExplorer.Text = "&Solution Explorer"; + this.menuItemSolutionExplorer.Click += new System.EventHandler(this.menuItemSolutionExplorer_Click); + // + // menuItemPropertyWindow + // + this.menuItemPropertyWindow.Name = "menuItemPropertyWindow"; + this.menuItemPropertyWindow.ShortcutKeys = System.Windows.Forms.Keys.F4; + this.menuItemPropertyWindow.Size = new System.Drawing.Size(176, 22); + this.menuItemPropertyWindow.Text = "&Property Window"; + this.menuItemPropertyWindow.Click += new System.EventHandler(this.menuItemPropertyWindow_Click); + // + // menuItemToolbox + // + this.menuItemToolbox.Name = "menuItemToolbox"; + this.menuItemToolbox.Size = new System.Drawing.Size(176, 22); + this.menuItemToolbox.Text = "&Toolbox"; + this.menuItemToolbox.Click += new System.EventHandler(this.menuItemToolbox_Click); + // + // menuItemOutputWindow + // + this.menuItemOutputWindow.Name = "menuItemOutputWindow"; + this.menuItemOutputWindow.Size = new System.Drawing.Size(176, 22); + this.menuItemOutputWindow.Text = "&Output Window"; + this.menuItemOutputWindow.Click += new System.EventHandler(this.menuItemOutputWindow_Click); + // + // menuItemTaskList + // + this.menuItemTaskList.Name = "menuItemTaskList"; + this.menuItemTaskList.Size = new System.Drawing.Size(176, 22); + this.menuItemTaskList.Text = "Task &List"; + this.menuItemTaskList.Click += new System.EventHandler(this.menuItemTaskList_Click); + // + // menuItem1 + // + this.menuItem1.Name = "menuItem1"; + this.menuItem1.Size = new System.Drawing.Size(173, 6); + // + // menuItemToolBar + // + this.menuItemToolBar.Checked = true; + this.menuItemToolBar.CheckState = System.Windows.Forms.CheckState.Checked; + this.menuItemToolBar.Name = "menuItemToolBar"; + this.menuItemToolBar.Size = new System.Drawing.Size(176, 22); + this.menuItemToolBar.Text = "Tool &Bar"; + this.menuItemToolBar.Click += new System.EventHandler(this.menuItemToolBar_Click); + // + // menuItemStatusBar + // + this.menuItemStatusBar.Checked = true; + this.menuItemStatusBar.CheckState = System.Windows.Forms.CheckState.Checked; + this.menuItemStatusBar.Name = "menuItemStatusBar"; + this.menuItemStatusBar.Size = new System.Drawing.Size(176, 22); + this.menuItemStatusBar.Text = "Status B&ar"; + this.menuItemStatusBar.Click += new System.EventHandler(this.menuItemStatusBar_Click); + // + // menuItem2 + // + this.menuItem2.Name = "menuItem2"; + this.menuItem2.Size = new System.Drawing.Size(173, 6); + // + // menuItemLayoutByCode + // + this.menuItemLayoutByCode.Name = "menuItemLayoutByCode"; + this.menuItemLayoutByCode.Size = new System.Drawing.Size(176, 22); + this.menuItemLayoutByCode.Text = "Layout By &Code"; + this.menuItemLayoutByCode.Click += new System.EventHandler(this.menuItemLayoutByCode_Click); + // + // menuItemLayoutByXml + // + this.menuItemLayoutByXml.Name = "menuItemLayoutByXml"; + this.menuItemLayoutByXml.Size = new System.Drawing.Size(176, 22); + this.menuItemLayoutByXml.Text = "Layout By &XML"; + this.menuItemLayoutByXml.Click += new System.EventHandler(this.menuItemLayoutByXml_Click); + // + // menuItemTools + // + this.menuItemTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuItemLockLayout, + this.menuItemShowDocumentIcon, + this.menuItem3, + this.menuItemSchemaVS2005, + this.menuItemSchemaVS2003, + this.menuItem6, + this.menuItemDockingMdi, + this.menuItemDockingSdi, + this.menuItemDockingWindow, + this.menuItemSystemMdi, + this.menuItem5, + this.showRightToLeft}); + this.menuItemTools.MergeIndex = 2; + this.menuItemTools.Name = "menuItemTools"; + this.menuItemTools.Size = new System.Drawing.Size(44, 20); + this.menuItemTools.Text = "&Tools"; + this.menuItemTools.DropDownOpening += new System.EventHandler(this.menuItemTools_Popup); + // + // menuItemLockLayout + // + this.menuItemLockLayout.Name = "menuItemLockLayout"; + this.menuItemLockLayout.Size = new System.Drawing.Size(234, 22); + this.menuItemLockLayout.Text = "&Lock Layout"; + this.menuItemLockLayout.Click += new System.EventHandler(this.menuItemLockLayout_Click); + // + // menuItemShowDocumentIcon + // + this.menuItemShowDocumentIcon.Name = "menuItemShowDocumentIcon"; + this.menuItemShowDocumentIcon.Size = new System.Drawing.Size(234, 22); + this.menuItemShowDocumentIcon.Text = "&Show Document Icon"; + this.menuItemShowDocumentIcon.Click += new System.EventHandler(this.menuItemShowDocumentIcon_Click); + // + // menuItem3 + // + this.menuItem3.Name = "menuItem3"; + this.menuItem3.Size = new System.Drawing.Size(231, 6); + // + // menuItemSchemaVS2005 + // + this.menuItemSchemaVS2005.Checked = true; + this.menuItemSchemaVS2005.CheckState = System.Windows.Forms.CheckState.Checked; + this.menuItemSchemaVS2005.Name = "menuItemSchemaVS2005"; + this.menuItemSchemaVS2005.Size = new System.Drawing.Size(234, 22); + this.menuItemSchemaVS2005.Text = "Schema: VS200&5"; + this.menuItemSchemaVS2005.Click += new System.EventHandler(this.SetSchema); + // + // menuItemSchemaVS2003 + // + this.menuItemSchemaVS2003.Name = "menuItemSchemaVS2003"; + this.menuItemSchemaVS2003.Size = new System.Drawing.Size(234, 22); + this.menuItemSchemaVS2003.Text = "Schema: VS200&3"; + this.menuItemSchemaVS2003.Click += new System.EventHandler(this.SetSchema); + // + // menuItem6 + // + this.menuItem6.Name = "menuItem6"; + this.menuItem6.Size = new System.Drawing.Size(231, 6); + // + // menuItemDockingMdi + // + this.menuItemDockingMdi.Checked = true; + this.menuItemDockingMdi.CheckState = System.Windows.Forms.CheckState.Checked; + this.menuItemDockingMdi.Name = "menuItemDockingMdi"; + this.menuItemDockingMdi.Size = new System.Drawing.Size(234, 22); + this.menuItemDockingMdi.Text = "Document Style: Docking &MDI"; + this.menuItemDockingMdi.Click += new System.EventHandler(this.SetDocumentStyle); + // + // menuItemDockingSdi + // + this.menuItemDockingSdi.Name = "menuItemDockingSdi"; + this.menuItemDockingSdi.Size = new System.Drawing.Size(234, 22); + this.menuItemDockingSdi.Text = "Document Style: Docking &SDI"; + this.menuItemDockingSdi.Click += new System.EventHandler(this.SetDocumentStyle); + // + // menuItemDockingWindow + // + this.menuItemDockingWindow.Name = "menuItemDockingWindow"; + this.menuItemDockingWindow.Size = new System.Drawing.Size(234, 22); + this.menuItemDockingWindow.Text = "Document Style: Docking &Window"; + this.menuItemDockingWindow.Click += new System.EventHandler(this.SetDocumentStyle); + // + // menuItemSystemMdi + // + this.menuItemSystemMdi.Name = "menuItemSystemMdi"; + this.menuItemSystemMdi.Size = new System.Drawing.Size(234, 22); + this.menuItemSystemMdi.Text = "Document Style: S&ystem MDI"; + this.menuItemSystemMdi.Click += new System.EventHandler(this.SetDocumentStyle); + // + // menuItem5 + // + this.menuItem5.Name = "menuItem5"; + this.menuItem5.Size = new System.Drawing.Size(231, 6); + // + // showRightToLeft + // + this.showRightToLeft.Name = "showRightToLeft"; + this.showRightToLeft.Size = new System.Drawing.Size(234, 22); + this.showRightToLeft.Text = "Show &Right-To-Left"; + this.showRightToLeft.Click += new System.EventHandler(this.showRightToLeft_Click); + // + // menuItemWindow + // + this.menuItemWindow.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuItemNewWindow}); + this.menuItemWindow.MergeIndex = 2; + this.menuItemWindow.Name = "menuItemWindow"; + this.menuItemWindow.Size = new System.Drawing.Size(57, 20); + this.menuItemWindow.Text = "&Window"; + // + // menuItemNewWindow + // + this.menuItemNewWindow.Name = "menuItemNewWindow"; + this.menuItemNewWindow.Size = new System.Drawing.Size(136, 22); + this.menuItemNewWindow.Text = "&New Window"; + this.menuItemNewWindow.Click += new System.EventHandler(this.menuItemNewWindow_Click); + // + // menuItemHelp + // + this.menuItemHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuItemAbout}); + this.menuItemHelp.MergeIndex = 3; + this.menuItemHelp.Name = "menuItemHelp"; + this.menuItemHelp.Size = new System.Drawing.Size(40, 20); + this.menuItemHelp.Text = "&Help"; + // + // menuItemAbout + // + this.menuItemAbout.Name = "menuItemAbout"; + this.menuItemAbout.Size = new System.Drawing.Size(175, 22); + this.menuItemAbout.Text = "&About DockSample..."; + this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click); + // + // imageList + // + this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); + this.imageList.TransparentColor = System.Drawing.Color.Transparent; + this.imageList.Images.SetKeyName(0, ""); + this.imageList.Images.SetKeyName(1, ""); + this.imageList.Images.SetKeyName(2, ""); + this.imageList.Images.SetKeyName(3, ""); + this.imageList.Images.SetKeyName(4, ""); + this.imageList.Images.SetKeyName(5, ""); + this.imageList.Images.SetKeyName(6, ""); + this.imageList.Images.SetKeyName(7, ""); + this.imageList.Images.SetKeyName(8, ""); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.toolBar, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.dockPanel, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.statusBar, 0, 2); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(579, 385); + this.tableLayoutPanel1.TabIndex = 9; + // + // toolBar + // + this.toolBar.ImageList = this.imageList; + this.toolBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolBarButtonNew, + this.toolBarButtonOpen, + this.toolBarButtonSeparator1, + this.toolBarButtonSolutionExplorer, + this.toolBarButtonPropertyWindow, + this.toolBarButtonToolbox, + this.toolBarButtonOutputWindow, + this.toolBarButtonTaskList, + this.toolBarButtonSeparator2, + this.toolBarButtonLayoutByCode, + this.toolBarButtonLayoutByXml}); + this.toolBar.Location = new System.Drawing.Point(0, 0); + this.toolBar.Name = "toolBar"; + this.toolBar.Size = new System.Drawing.Size(579, 25); + this.toolBar.TabIndex = 7; + // + // toolBarButtonNew + // + this.toolBarButtonNew.ImageIndex = 0; + this.toolBarButtonNew.Name = "toolBarButtonNew"; + this.toolBarButtonNew.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonNew.ToolTipText = "Show Layout From XML"; + // + // toolBarButtonOpen + // + this.toolBarButtonOpen.ImageIndex = 1; + this.toolBarButtonOpen.Name = "toolBarButtonOpen"; + this.toolBarButtonOpen.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonOpen.ToolTipText = "Open"; + // + // toolBarButtonSeparator1 + // + this.toolBarButtonSeparator1.Name = "toolBarButtonSeparator1"; + this.toolBarButtonSeparator1.Size = new System.Drawing.Size(6, 25); + // + // toolBarButtonSolutionExplorer + // + this.toolBarButtonSolutionExplorer.ImageIndex = 2; + this.toolBarButtonSolutionExplorer.Name = "toolBarButtonSolutionExplorer"; + this.toolBarButtonSolutionExplorer.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonSolutionExplorer.ToolTipText = "Solution Explorer"; + // + // toolBarButtonPropertyWindow + // + this.toolBarButtonPropertyWindow.ImageIndex = 3; + this.toolBarButtonPropertyWindow.Name = "toolBarButtonPropertyWindow"; + this.toolBarButtonPropertyWindow.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonPropertyWindow.ToolTipText = "Property Window"; + // + // toolBarButtonToolbox + // + this.toolBarButtonToolbox.ImageIndex = 4; + this.toolBarButtonToolbox.Name = "toolBarButtonToolbox"; + this.toolBarButtonToolbox.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonToolbox.ToolTipText = "Tool Box"; + // + // toolBarButtonOutputWindow + // + this.toolBarButtonOutputWindow.ImageIndex = 5; + this.toolBarButtonOutputWindow.Name = "toolBarButtonOutputWindow"; + this.toolBarButtonOutputWindow.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonOutputWindow.ToolTipText = "Output Window"; + // + // toolBarButtonTaskList + // + this.toolBarButtonTaskList.ImageIndex = 6; + this.toolBarButtonTaskList.Name = "toolBarButtonTaskList"; + this.toolBarButtonTaskList.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonTaskList.ToolTipText = "Task List"; + // + // toolBarButtonSeparator2 + // + this.toolBarButtonSeparator2.Name = "toolBarButtonSeparator2"; + this.toolBarButtonSeparator2.Size = new System.Drawing.Size(6, 25); + // + // toolBarButtonLayoutByCode + // + this.toolBarButtonLayoutByCode.ImageIndex = 7; + this.toolBarButtonLayoutByCode.Name = "toolBarButtonLayoutByCode"; + this.toolBarButtonLayoutByCode.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonLayoutByCode.ToolTipText = "Show Layout By Code"; + // + // toolBarButtonLayoutByXml + // + this.toolBarButtonLayoutByXml.ImageIndex = 8; + this.toolBarButtonLayoutByXml.Name = "toolBarButtonLayoutByXml"; + this.toolBarButtonLayoutByXml.Size = new System.Drawing.Size(23, 22); + this.toolBarButtonLayoutByXml.ToolTipText = "Show layout by predefined XML file"; + // + // dockPanel + // + this.dockPanel.ActiveAutoHideContent = null; + this.dockPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.dockPanel.DockBottomPortion = 150; + this.dockPanel.DockLeftPortion = 200; + this.dockPanel.DockRightPortion = 200; + this.dockPanel.DockTopPortion = 150; + this.dockPanel.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.DockingWindow; + this.dockPanel.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(0))); + this.dockPanel.Location = new System.Drawing.Point(3, 28); + this.dockPanel.Name = "dockPanel"; + this.dockPanel.RightToLeftLayout = true; + this.dockPanel.Size = new System.Drawing.Size(573, 332); + this.dockPanel.TabIndex = 10; + // + // statusBar + // + this.statusBar.Location = new System.Drawing.Point(0, 363); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(579, 22); + this.statusBar.TabIndex = 8; + // + // MainForm2 + // + this.ClientSize = new System.Drawing.Size(579, 409); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.mainMenu); + this.IsMdiContainer = true; + this.MainMenuStrip = this.mainMenu; + this.Name = "MainForm2"; + this.Text = "DockSample"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing); + this.Load += new System.EventHandler(this.MainForm_Load); + this.mainMenu.ResumeLayout(false); + this.mainMenu.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.toolBar.ResumeLayout(false); + this.toolBar.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + private System.Windows.Forms.ImageList imageList; + private System.Windows.Forms.MenuStrip mainMenu; + private System.Windows.Forms.ToolStripMenuItem menuItemFile; + private System.Windows.Forms.ToolStripMenuItem menuItemNew; + private System.Windows.Forms.ToolStripMenuItem menuItemOpen; + private System.Windows.Forms.ToolStripMenuItem menuItemClose; + private System.Windows.Forms.ToolStripMenuItem menuItemCloseAll; + private System.Windows.Forms.ToolStripMenuItem menuItemCloseAllButThisOne; + private System.Windows.Forms.ToolStripSeparator menuItem4; + private System.Windows.Forms.ToolStripMenuItem menuItemExit; + private System.Windows.Forms.ToolStripMenuItem menuItemView; + private System.Windows.Forms.ToolStripMenuItem menuItemSolutionExplorer; + private System.Windows.Forms.ToolStripMenuItem menuItemPropertyWindow; + private System.Windows.Forms.ToolStripMenuItem menuItemToolbox; + private System.Windows.Forms.ToolStripMenuItem menuItemOutputWindow; + private System.Windows.Forms.ToolStripMenuItem menuItemTaskList; + private System.Windows.Forms.ToolStripSeparator menuItem1; + private System.Windows.Forms.ToolStripMenuItem menuItemToolBar; + private System.Windows.Forms.ToolStripMenuItem menuItemStatusBar; + private System.Windows.Forms.ToolStripSeparator menuItem2; + private System.Windows.Forms.ToolStripMenuItem menuItemLayoutByCode; + private System.Windows.Forms.ToolStripMenuItem menuItemLayoutByXml; + private System.Windows.Forms.ToolStripMenuItem menuItemTools; + private System.Windows.Forms.ToolStripMenuItem menuItemLockLayout; + private System.Windows.Forms.ToolStripSeparator menuItem3; + private System.Windows.Forms.ToolStripMenuItem menuItemSchemaVS2005; + private System.Windows.Forms.ToolStripMenuItem menuItemSchemaVS2003; + private System.Windows.Forms.ToolStripSeparator menuItem6; + private System.Windows.Forms.ToolStripMenuItem menuItemDockingMdi; + private System.Windows.Forms.ToolStripMenuItem menuItemDockingSdi; + private System.Windows.Forms.ToolStripMenuItem menuItemDockingWindow; + private System.Windows.Forms.ToolStripMenuItem menuItemSystemMdi; + private System.Windows.Forms.ToolStripSeparator menuItem5; + private System.Windows.Forms.ToolStripMenuItem menuItemShowDocumentIcon; + private System.Windows.Forms.ToolStripMenuItem menuItemWindow; + private System.Windows.Forms.ToolStripMenuItem menuItemNewWindow; + private System.Windows.Forms.ToolStripMenuItem menuItemHelp; + private System.Windows.Forms.ToolStripMenuItem menuItemAbout; + private System.Windows.Forms.ToolStripMenuItem showRightToLeft; + private System.Windows.Forms.ToolStripMenuItem exitWithoutSavingLayout; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private WeifenLuo.WinFormsUI.Docking.DockPanel dockPanel; + private System.Windows.Forms.StatusStrip statusBar; + private System.Windows.Forms.ToolStrip toolBar; + private System.Windows.Forms.ToolStripButton toolBarButtonNew; + private System.Windows.Forms.ToolStripButton toolBarButtonOpen; + private System.Windows.Forms.ToolStripSeparator toolBarButtonSeparator1; + private System.Windows.Forms.ToolStripButton toolBarButtonSolutionExplorer; + private System.Windows.Forms.ToolStripButton toolBarButtonPropertyWindow; + private System.Windows.Forms.ToolStripButton toolBarButtonToolbox; + private System.Windows.Forms.ToolStripButton toolBarButtonOutputWindow; + private System.Windows.Forms.ToolStripButton toolBarButtonTaskList; + private System.Windows.Forms.ToolStripSeparator toolBarButtonSeparator2; + private System.Windows.Forms.ToolStripButton toolBarButtonLayoutByCode; + private System.Windows.Forms.ToolStripButton toolBarButtonLayoutByXml; + } +} \ No newline at end of file diff --git a/src/Libraries/DockPanel_Src/DockSample/MainForm2.cs b/src/Libraries/DockPanel_Src/DockSample/MainForm2.cs new file mode 100644 index 0000000000..dfe83880cb --- /dev/null +++ b/src/Libraries/DockPanel_Src/DockSample/MainForm2.cs @@ -0,0 +1,443 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Reflection; +using System.Windows.Forms; +using System.IO; +using WeifenLuo.WinFormsUI.Docking; +using DockSample.Customization; + +namespace DockSample +{ + public partial class MainForm2 : Form + { + private bool m_bSaveLayout = true; + private DeserializeDockContent m_deserializeDockContent; + private DummySolutionExplorer m_solutionExplorer = new DummySolutionExplorer(); + private DummyPropertyWindow m_propertyWindow = new DummyPropertyWindow(); + private DummyToolbox m_toolbox = new DummyToolbox(); + private DummyOutputWindow m_outputWindow = new DummyOutputWindow(); + private DummyTaskList m_taskList = new DummyTaskList(); + + public MainForm2() + { + InitializeComponent(); + showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes); + RightToLeftLayout = showRightToLeft.Checked; + m_solutionExplorer = new DummySolutionExplorer(); + m_solutionExplorer.RightToLeftLayout = RightToLeftLayout; + m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString); + } + + private void menuItemExit_Click(object sender, System.EventArgs e) + { + Close(); + } + + private void menuItemSolutionExplorer_Click(object sender, System.EventArgs e) + { + m_solutionExplorer.Show(dockPanel); + } + + private void menuItemPropertyWindow_Click(object sender, System.EventArgs e) + { + m_propertyWindow.Show(dockPanel); + } + + private void menuItemToolbox_Click(object sender, System.EventArgs e) + { + m_toolbox.Show(dockPanel); + } + + private void menuItemOutputWindow_Click(object sender, System.EventArgs e) + { + m_outputWindow.Show(dockPanel); + } + + private void menuItemTaskList_Click(object sender, System.EventArgs e) + { + m_taskList.Show(dockPanel); + } + + private void menuItemAbout_Click(object sender, System.EventArgs e) + { + AboutDialog aboutDialog = new AboutDialog(); + aboutDialog.ShowDialog(this); + } + + private IDockContent FindDocument(string text) + { + if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) + { + foreach (Form form in MdiChildren) + if (form.Text == text) + return form as IDockContent; + + return null; + } + else + { + foreach (IDockContent content in dockPanel.Documents) + if (content.DockHandler.TabText == text) + return content; + + return null; + } + } + + private void menuItemNew_Click(object sender, System.EventArgs e) + { + DummyDoc dummyDoc = CreateNewDocument(); + if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) + { + dummyDoc.MdiParent = this; + dummyDoc.Show(); + } + else + dummyDoc.Show(dockPanel); + } + + private DummyDoc CreateNewDocument() + { + DummyDoc dummyDoc = new DummyDoc(); + + int count = 1; + //string text = "C:\\MADFDKAJ\\ADAKFJASD\\ADFKDSAKFJASD\\ASDFKASDFJASDF\\ASDFIJADSFJ\\ASDFKDFDA" + count.ToString(); + string text = "Document" + count.ToString(); + while (FindDocument(text) != null) + { + count ++; + //text = "C:\\MADFDKAJ\\ADAKFJASD\\ADFKDSAKFJASD\\ASDFKASDFJASDF\\ASDFIJADSFJ\\ASDFKDFDA" + count.ToString(); + text = "Document" + count.ToString(); + } + dummyDoc.Text = text; + return dummyDoc; + } + + private DummyDoc CreateNewDocument(string text) + { + DummyDoc dummyDoc = new DummyDoc(); + dummyDoc.Text = text; + return dummyDoc; + } + + private void menuItemOpen_Click(object sender, System.EventArgs e) + { + OpenFileDialog openFile = new OpenFileDialog(); + + openFile.InitialDirectory = Application.ExecutablePath; + openFile.Filter = "rtf files (*.rtf)|*.rtf|txt files (*.txt)|*.txt|All files (*.*)|*.*" ; + openFile.FilterIndex = 1; + openFile.RestoreDirectory = true ; + + if(openFile.ShowDialog() == DialogResult.OK) + { + string fullName = openFile.FileName; + string fileName = Path.GetFileName(fullName); + + if (FindDocument(fileName) != null) + { + MessageBox.Show("The document: " + fileName + " has already opened!"); + return; + } + + DummyDoc dummyDoc = new DummyDoc(); + dummyDoc.Text = fileName; + dummyDoc.Show(dockPanel); + try + { + dummyDoc.FileName = fullName; + } + catch (Exception exception) + { + dummyDoc.Close(); + MessageBox.Show(exception.Message); + } + + } + } + + private void menuItemFile_Popup(object sender, System.EventArgs e) + { + if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) + { + menuItemClose.Enabled = menuItemCloseAll.Enabled = (ActiveMdiChild != null); + } + else + { + menuItemClose.Enabled = (dockPanel.ActiveDocument != null); + menuItemCloseAll.Enabled = (dockPanel.DocumentsCount > 0); + } + } + + private void menuItemClose_Click(object sender, System.EventArgs e) + { + if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) + ActiveMdiChild.Close(); + else if (dockPanel.ActiveDocument != null) + dockPanel.ActiveDocument.DockHandler.Close(); + } + + private void menuItemCloseAll_Click(object sender, System.EventArgs e) + { + CloseAllDocuments(); + } + + private void CloseAllDocuments() + { + if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) + { + foreach (Form form in MdiChildren) + form.Close(); + } + else + { + IDockContent[] documents = dockPanel.DocumentsToArray(); + foreach (IDockContent content in documents) + content.DockHandler.Close(); + } + } + + private IDockContent GetContentFromPersistString(string persistString) + { + if (persistString == typeof(DummySolutionExplorer).ToString()) + return m_solutionExplorer; + else if (persistString == typeof(DummyPropertyWindow).ToString()) + return m_propertyWindow; + else if (persistString == typeof(DummyToolbox).ToString()) + return m_toolbox; + else if (persistString == typeof(DummyOutputWindow).ToString()) + return m_outputWindow; + else if (persistString == typeof(DummyTaskList).ToString()) + return m_taskList; + else + { + string[] parsedStrings = persistString.Split(new char[] { ',' }); + if (parsedStrings.Length != 3) + return null; + + if (parsedStrings[0] != typeof(DummyDoc).ToString()) + return null; + + DummyDoc dummyDoc = new DummyDoc(); + if (parsedStrings[1] != string.Empty) + dummyDoc.FileName = parsedStrings[1]; + if (parsedStrings[2] != string.Empty) + dummyDoc.Text = parsedStrings[2]; + + return dummyDoc; + } + } + + private void MainForm_Load(object sender, System.EventArgs e) + { + string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config"); + + if (File.Exists(configFile)) + dockPanel.LoadFromXml(configFile, m_deserializeDockContent); + } + + private void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config"); + if (m_bSaveLayout) + dockPanel.SaveAsXml(configFile); + else if (File.Exists(configFile)) + File.Delete(configFile); + } + + private void menuItemToolBar_Click(object sender, System.EventArgs e) + { + toolBar.Visible = menuItemToolBar.Checked = !menuItemToolBar.Checked; + } + + private void menuItemStatusBar_Click(object sender, System.EventArgs e) + { + statusBar.Visible = menuItemStatusBar.Checked = !menuItemStatusBar.Checked; + } + + private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolStripItemClickedEventArgs e) + { + if (e.ClickedItem == toolBarButtonNew) + menuItemNew_Click(null, null); + else if (e.ClickedItem == toolBarButtonOpen) + menuItemOpen_Click(null, null); + else if (e.ClickedItem == toolBarButtonSolutionExplorer) + menuItemSolutionExplorer_Click(null, null); + else if (e.ClickedItem == toolBarButtonPropertyWindow) + menuItemPropertyWindow_Click(null, null); + else if (e.ClickedItem == toolBarButtonToolbox) + menuItemToolbox_Click(null, null); + else if (e.ClickedItem == toolBarButtonOutputWindow) + menuItemOutputWindow_Click(null, null); + else if (e.ClickedItem == toolBarButtonTaskList) + menuItemTaskList_Click(null, null); + else if (e.ClickedItem == toolBarButtonLayoutByCode) + menuItemLayoutByCode_Click(null, null); + else if (e.ClickedItem == toolBarButtonLayoutByXml) + menuItemLayoutByXml_Click(null, null); + } + + private void menuItemNewWindow_Click(object sender, System.EventArgs e) + { + MainForm newWindow = new MainForm(); + newWindow.Text = newWindow.Text + " - New"; + newWindow.Show(); + } + + private void menuItemTools_Popup(object sender, System.EventArgs e) + { + menuItemLockLayout.Checked = !this.dockPanel.AllowEndUserDocking; + } + + private void menuItemLockLayout_Click(object sender, System.EventArgs e) + { + dockPanel.AllowEndUserDocking = !dockPanel.AllowEndUserDocking; + } + + private void menuItemLayoutByCode_Click(object sender, System.EventArgs e) + { + dockPanel.SuspendLayout(true); + + m_solutionExplorer.Show(dockPanel, DockState.DockRight); + m_propertyWindow.Show(m_solutionExplorer.Pane, m_solutionExplorer); + m_toolbox.Show(dockPanel, new Rectangle(98, 133, 200, 383)); + m_outputWindow.Show(m_solutionExplorer.Pane, DockAlignment.Bottom, 0.35); + m_taskList.Show(m_toolbox.Pane, DockAlignment.Left, 0.4); + + CloseAllDocuments(); + DummyDoc doc1 = CreateNewDocument("Document1"); + DummyDoc doc2 = CreateNewDocument("Document2"); + DummyDoc doc3 = CreateNewDocument("Document3"); + DummyDoc doc4 = CreateNewDocument("Document4"); + doc1.Show(dockPanel, DockState.Document); + doc2.Show(doc1.Pane, null); + doc3.Show(doc1.Pane, DockAlignment.Bottom, 0.5); + doc4.Show(doc3.Pane, DockAlignment.Right, 0.5); + + dockPanel.ResumeLayout(true, true); + } + + private void menuItemLayoutByXml_Click(object sender, System.EventArgs e) + { + dockPanel.SuspendLayout(true); + + // In order to load layout from XML, we need to close all the DockContents + CloseAllContents(); + + Assembly assembly = Assembly.GetAssembly(typeof(MainForm)); + Stream xmlStream = assembly.GetManifestResourceStream("DockSample.Resources.DockPanel.xml"); + dockPanel.LoadFromXml(xmlStream, m_deserializeDockContent); + xmlStream.Close(); + + dockPanel.ResumeLayout(true, true); + } + + private void CloseAllContents() + { + // we don't want to create another instance of tool window, set DockPanel to null + m_solutionExplorer.DockPanel = null; + m_propertyWindow.DockPanel = null; + m_toolbox.DockPanel = null; + m_outputWindow.DockPanel = null; + m_taskList.DockPanel = null; + + // Close all other document windows + CloseAllDocuments(); + } + + private void SetSchema(object sender, System.EventArgs e) + { + CloseAllContents(); + + if (sender == menuItemSchemaVS2005) + Extender.SetSchema(dockPanel, Extender.Schema.VS2005); + else if (sender == menuItemSchemaVS2003) + Extender.SetSchema(dockPanel, Extender.Schema.VS2003); + + menuItemSchemaVS2005.Checked = (sender == menuItemSchemaVS2005); + menuItemSchemaVS2003.Checked = (sender == menuItemSchemaVS2003); + } + + private void SetDocumentStyle(object sender, System.EventArgs e) + { + DocumentStyle oldStyle = dockPanel.DocumentStyle; + DocumentStyle newStyle; + if (sender == menuItemDockingMdi) + newStyle = DocumentStyle.DockingMdi; + else if (sender == menuItemDockingWindow) + newStyle = DocumentStyle.DockingWindow; + else if (sender == menuItemDockingSdi) + newStyle = DocumentStyle.DockingSdi; + else + newStyle = DocumentStyle.SystemMdi; + + if (oldStyle == newStyle) + return; + + if (oldStyle == DocumentStyle.SystemMdi || newStyle == DocumentStyle.SystemMdi) + CloseAllDocuments(); + + dockPanel.DocumentStyle = newStyle; + menuItemDockingMdi.Checked = (newStyle == DocumentStyle.DockingMdi); + menuItemDockingWindow.Checked = (newStyle == DocumentStyle.DockingWindow); + menuItemDockingSdi.Checked = (newStyle == DocumentStyle.DockingSdi); + menuItemSystemMdi.Checked = (newStyle == DocumentStyle.SystemMdi); + menuItemLayoutByCode.Enabled = (newStyle != DocumentStyle.SystemMdi); + menuItemLayoutByXml.Enabled = (newStyle != DocumentStyle.SystemMdi); + toolBarButtonLayoutByCode.Enabled = (newStyle != DocumentStyle.SystemMdi); + toolBarButtonLayoutByXml.Enabled = (newStyle != DocumentStyle.SystemMdi); + } + + private void menuItemCloseAllButThisOne_Click(object sender, System.EventArgs e) + { + if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) + { + Form activeMdi = ActiveMdiChild; + foreach (Form form in MdiChildren) + { + if (form != activeMdi) + form.Close(); + } + } + else + { + foreach (IDockContent document in dockPanel.DocumentsToArray()) + { + if (!document.DockHandler.IsActivated) + document.DockHandler.Close(); + } + } + } + + private void menuItemShowDocumentIcon_Click(object sender, System.EventArgs e) + { + dockPanel.ShowDocumentIcon = menuItemShowDocumentIcon.Checked= !menuItemShowDocumentIcon.Checked; + } + + private void showRightToLeft_Click(object sender, EventArgs e) + { + CloseAllContents(); + if (showRightToLeft.Checked) + { + this.RightToLeft = RightToLeft.No; + this.RightToLeftLayout = false; + } + else + { + this.RightToLeft = RightToLeft.Yes; + this.RightToLeftLayout = true; + } + m_solutionExplorer.RightToLeftLayout = this.RightToLeftLayout; + showRightToLeft.Checked = !showRightToLeft.Checked; + } + + private void exitWithoutSavingLayout_Click(object sender, EventArgs e) + { + m_bSaveLayout = false; + Close(); + m_bSaveLayout = true; + } + } +} \ No newline at end of file diff --git a/src/Libraries/DockPanel_Src/DockSample/MainForm2.resx b/src/Libraries/DockPanel_Src/DockSample/MainForm2.resx new file mode 100644 index 0000000000..b34fbc3c84 --- /dev/null +++ b/src/Libraries/DockPanel_Src/DockSample/MainForm2.resx @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 120, 12 + + + 24, 9 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADY + DAAAAk1TRnQBSQFMAgEBCQEAAQ4BAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/0IAAewMBzMAAewL/wEH + MwAB7AP/BgIC/wEHMwAB7Av/AQczAAHsA/8GAgL/AQczAAHsC/8BBzMAAewB/wEHAQAC/wIAAv8BAAIH + MwAB7AEHAQAC/wEEAQIBBAEAAv8BAAHsMwAB7AH/AQcBAAH/AQIB/gECAQAB/wEAAgczAAHsAv8BBwL/ + AQIBBAT/AQczAAHsCf82AAHsCf8B7AEAAewzAAHsCf8C7DQAC+zmAAHsCwcEAAEBBwABBxcAAewK/wUA + AewK/wEHBQABAQUAAQcJAAr/BQAB7AP/AgcF/wUAAewE/wUHAf8BBwYAAQEDAAEHCgAB/wfsAv8FAAHs + A/8BAQIHBP8FAAHsCv8BBwcAAQEBAAEHCwAK/wUAAewC/wMBAgcD/wUAAewE/wUHAf8BBwgAAQcMAAH/ + COwB/wUAAewB/wIBAf8CAQEHA/8FAAHsAv8BAgf/AQcHAAEHAQABAQsACv8FAAHsBf8BAQHsAQcC/wUA + AewB/wICAf8BAgQHAf8BBwYAAQcDAAEBBAABAwUAAf8HAAL/BQAB7Ab/AQECBwH/BQAB7AL/AwIF/wEH + CwABAQMAAgMEAAr/BQAB7Af/AQEBBwH/BQAB7AH/AgIB/wICBP8BBw0AAgMGAAH/COwB/wUAAewI/wEB + Af8FAAHsAv8DAgT/AgcMAAMDBgAK/wUAAewK/wUAAewC/wECAf8CAgL/DwADAwUADAQEAAHsAv8GAAL/ + BQAB7AT/AQID/wHsAQAB7AoAAgMIAAwEBQAC7AEAAf8DBwEAAuwFAAHsCP8C7CkABOwIAArsqgABBAQA + AQM5AAEEAfwC+QEAAQMC+wQACv8IAAn/BgAJAwkAAewB/AEAA/kBAAL7AQAB+gIAAf8CAAH/BQAB/wgA + Cf8FAAH7AQAJAwUABP8BAAL/A/kCAAH/AfoCAAr/CAAJ/wUAAf8B+wEACQMEAAT/AfoBAAH/AQcD+QEA + Av8CAAH/AgAB/wUAAf8IAAn/BQAB+wH/AfsBAAkDAwAE/wL6Af8B+wEHA/kBAAH8AgAK/wgACf8FAAH/ + AfsB/wH7DAAF/wH6Af8B+wEHAf8C+QEAAfwCAAL/AgAD/wEAAv8IAAn/BQAB+wH/AfsB/wH7Af8B+wH/ + AfsHAAb/AgMD/wEBBAAC/wMAAf8DAAH/BAABBAMACf8FAAH/AfsB/wH7Af8B+wH/AfsB/wcADP8BBwMA + A/8KAAIEAwAJ/wUAAfsB/wH7DQAM/wEHEAACBAMABv8YAAz/AQcQAAIEAwAG/wEAAf8WAAz/AQcQAAIE + AwAG/xgADQQQAAIEIQANBBAAAgRAAAFCAU0BPgcAAT4DAAEoAwABQAMAATADAAEBAQABAQUAAYABARYA + A/8BAAGAAQEGAAGAAQEGAAGAAQEGAAGAAQEGAAGAAQEGAAGAAQEGAAGAAQEGAAGAAQEGAAGAAQEGAAGA + AQEGAAGAAQEGAAGAAQEGAAGAAQsGAAGAAQcGAAGAAQ8GAAL/BgAG/wHAAQEBnwHPAv8B4AEHAcABAQKP + AcABAwHAAQMBwAEBAccBHwHAAQMBwAEDAcABAQHiAT8BwAEDAcABAwHAAQEB8AF/AcABAwHAAQMBwAEB + AfgB/wHAAQMBwAEDAcABAQHwAXsBwAEDAcABAwHAAQEBAgExAcABAwHAAQMBwAEBAQcBAAHAAQMBwAED + AcABAQFnAYEBwAEDAcABAwHAAQEB5wGDAcABAwHAAQMBwAEBAccBAwHAAQMBwAEDAcABCwH8AQcBwAED + AeABBwHAAQcB/gEfAv8B/AE/AcABDxT/AfwBYwEAAQ8BwAEHAQABHwH4AQEBAAEPAcABBwEAAQ8BgAIA + AQ8BwAEHAQABBwGAAgABDwHAAQcBAAEDAYACAAEPAcABBwEAAQEBgAIAAQ8BwAEHAgABgAEBAQABDwHA + AQcBAAEfAYABAwEIAY4BwAEHAQABHwGAAQMBBQFEAcABBwEAAR8BgAEDAQIBuAHAAQcBjwHxAYABAwH9 + AXwBwAEPAf8B+QGAAQMB/gH8AcABHwH/AXUBgAEDAf8BAAHAAT8B/wGPAYABAwH/AfwI/ws= + + + + 226, 12 + + + 310, 13 + + \ No newline at end of file diff --git a/src/Libraries/DockPanel_Src/WinFormsUI.sln b/src/Libraries/DockPanel_Src/WinFormsUI.Docking.sln similarity index 50% rename from src/Libraries/DockPanel_Src/WinFormsUI.sln rename to src/Libraries/DockPanel_Src/WinFormsUI.Docking.sln index 881eb02c15..10268f1600 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI.sln +++ b/src/Libraries/DockPanel_Src/WinFormsUI.Docking.sln @@ -1,8 +1,8 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "WinFormsUI\WinFormsUI.csproj", "{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}" +# Visual C# Express 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "WinFormsUI\WinFormsUI.csproj", "{C75532C4-765B-418E-B09B-46D36B2ABDB1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockSample", "DockSample\DockSample.csproj", "{0A386EC6-40E1-4C5A-BA6B-B483FE89E8E7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockSample", "DockSample\DockSample.csproj", "{40793A27-478B-4357-B4C3-FC8943131F3D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,14 +10,14 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Release|Any CPU.Build.0 = Release|Any CPU - {0A386EC6-40E1-4C5A-BA6B-B483FE89E8E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A386EC6-40E1-4C5A-BA6B-B483FE89E8E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A386EC6-40E1-4C5A-BA6B-B483FE89E8E7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A386EC6-40E1-4C5A-BA6B-B483FE89E8E7}.Release|Any CPU.Build.0 = Release|Any CPU + {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|Any CPU.Build.0 = Release|Any CPU + {40793A27-478B-4357-B4C3-FC8943131F3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40793A27-478B-4357-B4C3-FC8943131F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40793A27-478B-4357-B4C3-FC8943131F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40793A27-478B-4357-B4C3-FC8943131F3D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Libraries/DockPanel_Src/WinFormsUI.ndoc b/src/Libraries/DockPanel_Src/WinFormsUI.ndoc deleted file mode 100644 index 53f8cb30d7..0000000000 --- a/src/Libraries/DockPanel_Src/WinFormsUI.ndoc +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Libraries/DockPanel_Src/WinFormsUI.suo b/src/Libraries/DockPanel_Src/WinFormsUI.suo deleted file mode 100644 index cccb6030a6..0000000000 Binary files a/src/Libraries/DockPanel_Src/WinFormsUI.suo and /dev/null differ diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockContentHandler.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockContentHandler.cs index 895958d614..1599837e17 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockContentHandler.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockContentHandler.cs @@ -357,7 +357,11 @@ namespace WeifenLuo.WinFormsUI.Docking dockState = DockState.Float; } else + { dockState = (PanelPane != null) ? PanelPane.DockState : DefaultDockState; + if (dockState != DockState.Unknown && !IsDockStateValid(dockState)) + dockState = DockState.Unknown; + } return dockState; } diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.AutoHideWindow.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.AutoHideWindow.cs index 7c15cfabc3..99866addef 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.AutoHideWindow.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.AutoHideWindow.cs @@ -410,6 +410,9 @@ namespace WeifenLuo.WinFormsUI.Docking private void TimerMouseTrack_Tick(object sender, EventArgs e) { + if (IsDisposed) + return; + if (ActivePane == null || ActivePane.IsActivated) { m_timerMouseTrack.Enabled = false; @@ -593,10 +596,11 @@ namespace WeifenLuo.WinFormsUI.Docking internal Rectangle GetAutoHideWindowBounds(Rectangle rectAutoHideWindow) { - if (Parent == null) - return Rectangle.Empty; - - return Parent.RectangleToClient(RectangleToScreen(rectAutoHideWindow)); + if (DocumentStyle == DocumentStyle.SystemMdi || + DocumentStyle == DocumentStyle.DockingMdi) + return (Parent == null) ? Rectangle.Empty : Parent.RectangleToClient(RectangleToScreen(rectAutoHideWindow)); + else + return rectAutoHideWindow; } internal void RefreshAutoHideStrip() diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.DockDragHandler.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.DockDragHandler.cs index dabb82d5e7..dc3c15f1c7 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.DockDragHandler.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.DockDragHandler.cs @@ -117,7 +117,7 @@ namespace WeifenLuo.WinFormsUI.Docking public DockStyle HitTest(Point pt) { - return ClientRectangle.Contains(PointToClient(pt)) ? DockStyle : DockStyle.None; + return this.Visible && ClientRectangle.Contains(PointToClient(pt)) ? DockStyle : DockStyle.None; } } #endregion PanelIndicator @@ -480,8 +480,8 @@ namespace WeifenLuo.WinFormsUI.Docking public override void Show(bool bActivate) { - Bounds = GetAllScreenBounds(); base.Show(bActivate); + Bounds = SystemInformation.VirtualScreen; RefreshChanges(); } @@ -518,31 +518,6 @@ namespace WeifenLuo.WinFormsUI.Docking { return hitTest.Status = hitTest.HitTest(pt); } - - private static Rectangle GetAllScreenBounds() - { - Rectangle rect = new Rectangle(0, 0, 0, 0); - foreach (Screen screen in Screen.AllScreens) - { - Rectangle rectScreen = screen.Bounds; - if (rectScreen.Left < rect.Left) - { - rect.Width += (rect.Left - rectScreen.Left); - rect.X = rectScreen.X; - } - if (rectScreen.Right > rect.Right) - rect.Width += (rectScreen.Right - rect.Right); - if (rectScreen.Top < rect.Top) - { - rect.Height += (rect.Top - rectScreen.Top); - rect.Y = rectScreen.Y; - } - if (rectScreen.Bottom > rect.Bottom) - rect.Height += (rectScreen.Bottom - rect.Bottom); - } - - return rect; - } } private class DockOutline : DockOutlineBase diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.FocusManager.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.FocusManager.cs index 5d9835f8d6..9621c02037 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.FocusManager.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.FocusManager.cs @@ -169,7 +169,11 @@ namespace WeifenLuo.WinFormsUI.Docking if (content.IsDisposed) return; + if (content == null) + return; DockContentHandler handler = content.DockHandler; + if (handler.Form.IsDisposed) + return; // Should not reach here, but better than throwing an exception if (ContentContains(content, handler.ActiveWindowHandle)) NativeMethods.SetFocus(handler.ActiveWindowHandle); if (!handler.Form.ContainsFocus) @@ -441,7 +445,7 @@ namespace WeifenLuo.WinFormsUI.Docking if (ActivePane != null && ActivePane.DockState == DockState.Document) value = ActivePane; - if (value == null) + if (value == null && DockPanel.DockWindows != null) { if (ActiveDocumentPane == null) value = DockPanel.DockWindows[DockState.Document].DefaultPane; diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.Persistor.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.Persistor.cs index 782bae76cd..5ecbc114d7 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.Persistor.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.Persistor.cs @@ -362,7 +362,7 @@ namespace WeifenLuo.WinFormsUI.Docking public static void LoadFromXml(DockPanel dockPanel, string fileName, DeserializeDockContent deserializeContent) { - FileStream fs = new FileStream(fileName, FileMode.Open); + FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); try { LoadFromXml(dockPanel, fs, deserializeContent); diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources/DockPanel.bmp b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.bmp similarity index 100% rename from src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources/DockPanel.bmp rename to src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.bmp diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.cs index b16c986ef7..6827c9d801 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanel.cs @@ -9,13 +9,25 @@ using System.Text; using System.Diagnostics.CodeAnalysis; using System.Collections.Generic; +// To simplify the process of finding the toolbox bitmap resource: +// #1 Create an internal class called "resfinder" outside of the root namespace. +// #2 Use "resfinder" in the toolbox bitmap attribute instead of the control name. +// #3 use the "." string to locate the resource. +// See: http://www.bobpowell.net/toolboxbitmap.htm +internal class resfinder +{ +} + namespace WeifenLuo.WinFormsUI.Docking { [SuppressMessage("Microsoft.Naming", "CA1720:AvoidTypeNamesInParameters", MessageId = "0#")] public delegate IDockContent DeserializeDockContent(string persistString); - [Designer(typeof(System.Windows.Forms.Design.ControlDesigner))] - [ToolboxBitmap(typeof(DockPanel), "Resources.DockPanel.bmp")] + [LocalizedDescription("DockPanel_Description")] + [Designer(typeof(System.Windows.Forms.Design.ControlDesigner))] + [ToolboxBitmap(typeof(resfinder), "WeifenLuo.WinFormsUI.Docking.DockPanel.bmp")] + [DefaultProperty("DocumentStyle")] + [DefaultEvent("ActiveContentChanged")] public partial class DockPanel : Panel { private FocusManagerImpl m_focusManager; @@ -35,10 +47,10 @@ namespace WeifenLuo.WinFormsUI.Docking m_floatWindows = new FloatWindowCollection(); SuspendLayout(); - Font = SystemInformation.MenuFont; m_autoHideWindow = new AutoHideWindowControl(this); m_autoHideWindow.Visible = false; + SetAutoHideWindowParent(); m_dummyControl = new DummyControl(); m_dummyControl.Bounds = new Rectangle(0, 0, 1, 1); @@ -70,6 +82,13 @@ namespace WeifenLuo.WinFormsUI.Docking return m_autoHideStripControl; } } + internal void ResetAutoHideStripControl() + { + if (m_autoHideStripControl != null) + m_autoHideStripControl.Dispose(); + + m_autoHideStripControl = null; + } private void MdiClientHandleAssigned(object sender, EventArgs e) { @@ -497,6 +516,7 @@ namespace WeifenLuo.WinFormsUI.Docking SuspendLayout(true); + SetAutoHideWindowParent(); SetMdiClient(); InvalidateWindowRegion(); @@ -738,12 +758,26 @@ namespace WeifenLuo.WinFormsUI.Docking protected override void OnParentChanged(EventArgs e) { - AutoHideWindow.Parent = this.Parent; - GetMdiClientController().ParentForm = (this.Parent as Form); - AutoHideWindow.BringToFront(); + SetAutoHideWindowParent(); + GetMdiClientController().ParentForm = (this.Parent as Form); base.OnParentChanged (e); } + private void SetAutoHideWindowParent() + { + Control parent; + if (DocumentStyle == DocumentStyle.DockingMdi || + DocumentStyle == DocumentStyle.SystemMdi) + parent = this.Parent; + else + parent = this; + if (AutoHideWindow.Parent != parent) + { + AutoHideWindow.Parent = parent; + AutoHideWindow.BringToFront(); + } + } + protected override void OnVisibleChanged(EventArgs e) { base.OnVisibleChanged (e); @@ -835,7 +869,7 @@ namespace WeifenLuo.WinFormsUI.Docking int count = 0; foreach (DockPane pane in this.Panes) { - if (pane.DockState != DockState.Document) + if (!pane.Visible || pane.DockState != DockState.Document) continue; count ++; @@ -851,7 +885,7 @@ namespace WeifenLuo.WinFormsUI.Docking int i = 0; foreach (DockPane pane in this.Panes) { - if (pane.DockState != DockState.Document) + if (!pane.Visible || pane.DockState != DockState.Document) continue; rects[i] = RectangleToClient(pane.RectangleToScreen(pane.ContentRectangle)); diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanelExtender.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanelExtender.cs index 5e5578e602..e304ea7551 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanelExtender.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockPanelExtender.cs @@ -218,6 +218,7 @@ namespace WeifenLuo.WinFormsUI.Docking return; m_autoHideStripFactory = value; + DockPanel.ResetAutoHideStripControl(); } } } diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/FloatWindow.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/FloatWindow.cs index a46b633fed..ee17428fe7 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/FloatWindow.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/FloatWindow.cs @@ -144,7 +144,7 @@ namespace WeifenLuo.WinFormsUI.Docking protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) { - Rectangle rectWorkArea = SystemInformation.WorkingArea; + Rectangle rectWorkArea = SystemInformation.VirtualScreen; if (y + height > rectWorkArea.Bottom) y -= (y + height) - rectWorkArea.Bottom; diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources.Designer.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources.Designer.cs index 246516ced7..076e5ddf6d 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources.Designer.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources.Designer.cs @@ -220,12 +220,5 @@ namespace WeifenLuo.WinFormsUI.Docking { return ((System.Drawing.Bitmap)(obj)); } } - - internal static System.Drawing.Bitmap DockPanel { - get { - object obj = ResourceManager.GetObject("DockPanel", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } } } diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources.resx b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources.resx index cc85b241b2..0f8b146299 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources.resx +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources.resx @@ -187,7 +187,4 @@ Resources\DockPane_OptionOverflow.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Resources\DockPanel.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - \ No newline at end of file diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources/Thumbs.db b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources/Thumbs.db new file mode 100644 index 0000000000..3bf72fa2ef Binary files /dev/null and b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Resources/Thumbs.db differ diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Strings.Designer.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Strings.Designer.cs index b26e7e959c..8ca97d176d 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Strings.Designer.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Strings.Designer.cs @@ -546,6 +546,15 @@ namespace WeifenLuo.WinFormsUI.Docking { } } + /// + /// Looks up a localized string similar to Provides Visual Studio .Net style docking.. + /// + internal static string DockPanel_Description { + get { + return ResourceManager.GetString("DockPanel_Description", resourceCulture); + } + } + /// /// Looks up a localized string similar to Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels.. /// diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Strings.resx b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Strings.resx index aabc443c51..96621ff8a0 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Strings.resx +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/Strings.resx @@ -279,6 +279,9 @@ The default size of float window. + + Provides Visual Studio .Net style docking. + Size of the bottom docking window. Value < 1 to specify the size in portion; value > 1 to specify the size in pixels. diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/VS2005DockPaneCaption.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/VS2005DockPaneCaption.cs index dae2a16ccb..20a0eec787 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Docking/VS2005DockPaneCaption.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Docking/VS2005DockPaneCaption.cs @@ -351,7 +351,7 @@ namespace WeifenLuo.WinFormsUI.Docking private void DrawCaption(Graphics g) { - if (ClientRectangle.IsEmpty) + if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0) return; if (DockPane.IsActivated) diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/Properties/AssemblyInfo.cs b/src/Libraries/DockPanel_Src/WinFormsUI/Properties/AssemblyInfo.cs index 009f88e97f..f0ba20e664 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/Properties/AssemblyInfo.cs +++ b/src/Libraries/DockPanel_Src/WinFormsUI/Properties/AssemblyInfo.cs @@ -18,11 +18,11 @@ using System.Diagnostics.CodeAnalysis; [assembly: Guid("9d690ef9-ce19-4c69-874c-e24d8eb36aff")] -[assembly: AssemblyVersion("2.1.0.1")] -[assembly: AssemblyFileVersion("2.1.0.1")] +[assembly: AssemblyVersion("2.2.*")] +[assembly: AssemblyFileVersion("2.2.0.0")] [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Weifen")] [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Luo")] [module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Weifen")] [module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Luo")] -[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Dockable")] \ No newline at end of file +[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Dockable")] diff --git a/src/Libraries/DockPanel_Src/WinFormsUI/WinFormsUI.csproj b/src/Libraries/DockPanel_Src/WinFormsUI/WinFormsUI.csproj index 8084a86a73..a4e090e7bc 100644 --- a/src/Libraries/DockPanel_Src/WinFormsUI/WinFormsUI.csproj +++ b/src/Libraries/DockPanel_Src/WinFormsUI/WinFormsUI.csproj @@ -20,7 +20,7 @@ true - Full + full false TRACE;DEBUG prompt @@ -33,16 +33,6 @@ prompt 4 - - False - - - False - Auto - 4194304 - AnyCPU - 4096 - @@ -192,7 +182,6 @@ - @@ -206,6 +195,9 @@ + + + - \ No newline at end of file +