From ada9ce7c443b0362ae72c8d0f618d4c367848c4c Mon Sep 17 00:00:00 2001 From: John Date: Tue, 15 Sep 2009 18:26:39 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20the=20problem=20with=20dragging=20the?= =?UTF-8?q?=20panels=20where=20it=20looked=20like=20the=20panel=20was=20cl?= =?UTF-8?q?osed=20but=20it=20really=20wasn=E2=80=99t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frmVEPROMS.Designer.cs | 94 ++++++++++++------- PROMS/VEPROMS User Interface/frmVEPROMS.cs | 76 +++++++++++++-- 2 files changed, 127 insertions(+), 43 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs index 02fdbce0..19bac743 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs @@ -71,7 +71,7 @@ namespace VEPROMS this.epAnnotations = new DevComponents.DotNetBar.ExpandablePanel(); this.ctrlAnnotationDetails = new Volian.Controls.Library.AnnotationDetails(); this.btnAnnoDetailsPushPin = new DevComponents.DotNetBar.ButtonX(); - this.expandablePanel2 = new DevComponents.DotNetBar.ExpandablePanel(); + this.epProcedures = new DevComponents.DotNetBar.ExpandablePanel(); this.tv = new Volian.Controls.Library.vlnTreeView(); this.infoPanel = new DevComponents.DotNetBar.ExpandablePanel(); this.infoTabs = new DevComponents.DotNetBar.TabControl(); @@ -110,7 +110,7 @@ namespace VEPROMS this.tc = new Volian.Controls.Library.DisplayTabControl(); ((System.ComponentModel.ISupportInitialize)(this.bottomBar)).BeginInit(); this.epAnnotations.SuspendLayout(); - this.expandablePanel2.SuspendLayout(); + this.epProcedures.SuspendLayout(); this.infoPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.infoTabs)).BeginInit(); this.infoTabs.SuspendLayout(); @@ -509,6 +509,9 @@ namespace VEPROMS this.epAnnotations.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; this.epAnnotations.TitleStyle.GradientAngle = 90; this.epAnnotations.TitleText = "Annotation Details"; + this.epAnnotations.ExpandedChanged += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.epAnnotations_ExpandedChanged); + this.epAnnotations.Resize += new System.EventHandler(this.epAnnotations_Resize); + this.epAnnotations.ExpandedChanging += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.expandPanelExpandedChanging); // // ctrlAnnotationDetails // @@ -544,35 +547,52 @@ namespace VEPROMS this.btnAnnoDetailsPushPin.TabIndex = 14; this.btnAnnoDetailsPushPin.ThemeAware = true; // - // expandablePanel2 + // epProcedures // - this.expandablePanel2.CanvasColor = System.Drawing.SystemColors.Control; - this.expandablePanel2.CollapseDirection = DevComponents.DotNetBar.eCollapseDirection.RightToLeft; - this.expandablePanel2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.expandablePanel2.Controls.Add(this.tv); - this.expandablePanel2.Dock = System.Windows.Forms.DockStyle.Left; - this.expandablePanel2.Expanded = false; - this.expandablePanel2.ExpandedBounds = new System.Drawing.Rectangle(4, 57, 326, 663); - this.expandablePanel2.ExpandOnTitleClick = true; - this.expandablePanel2.Location = new System.Drawing.Point(4, 57); - this.expandablePanel2.Name = "expandablePanel2"; - this.expandablePanel2.Size = new System.Drawing.Size(30, 663); - this.expandablePanel2.Style.Alignment = System.Drawing.StringAlignment.Center; - this.expandablePanel2.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.expandablePanel2.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.expandablePanel2.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.expandablePanel2.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.expandablePanel2.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; - this.expandablePanel2.Style.GradientAngle = 90; - this.expandablePanel2.TabIndex = 3; - this.expandablePanel2.TitleStyle.Alignment = System.Drawing.StringAlignment.Center; - this.expandablePanel2.TitleStyle.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.expandablePanel2.TitleStyle.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.expandablePanel2.TitleStyle.Border = DevComponents.DotNetBar.eBorderType.RaisedInner; - this.expandablePanel2.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.expandablePanel2.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.expandablePanel2.TitleStyle.GradientAngle = 90; - this.expandablePanel2.TitleText = "Procedures"; + this.epProcedures.CanvasColor = System.Drawing.SystemColors.Control; + this.epProcedures.CollapseDirection = DevComponents.DotNetBar.eCollapseDirection.RightToLeft; + this.epProcedures.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.epProcedures.Controls.Add(this.tv); + this.epProcedures.Dock = System.Windows.Forms.DockStyle.Left; + this.epProcedures.Expanded = false; + this.epProcedures.ExpandedBounds = new System.Drawing.Rectangle(4, 57, 326, 663); + this.epProcedures.ExpandOnTitleClick = true; + this.epProcedures.Location = new System.Drawing.Point(4, 57); + this.epProcedures.Name = "epProcedures"; + this.epProcedures.Size = new System.Drawing.Size(30, 663); + this.epProcedures.Style.Alignment = System.Drawing.StringAlignment.Center; + this.epProcedures.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.epProcedures.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.epProcedures.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.epProcedures.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.epProcedures.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; + this.epProcedures.Style.GradientAngle = 90; + this.epProcedures.TabIndex = 3; + this.epProcedures.TitleStyle.Alignment = System.Drawing.StringAlignment.Center; + this.epProcedures.TitleStyle.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.epProcedures.TitleStyle.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.epProcedures.TitleStyle.Border = DevComponents.DotNetBar.eBorderType.RaisedInner; + this.epProcedures.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.epProcedures.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.epProcedures.TitleStyle.GradientAngle = 90; + this.epProcedures.TitleText = "Procedures"; + this.epProcedures.ExpandedChanged += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.epProcedures_ExpandedChanged); + this.epProcedures.Resize += new System.EventHandler(this.resizeVerticalExpandedPanel); + this.epProcedures.ExpandedChanging += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.expandPanelExpandedChanging); + // + // tv + // + this.tv.AllowDrop = true; + this.tv.Dock = System.Windows.Forms.DockStyle.Fill; + this.tv.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tv.HideSelection = false; + this.tv.Location = new System.Drawing.Point(0, 26); + this.tv.Name = "tv"; + this.tv.Size = new System.Drawing.Size(30, 637); + this.tv.TabIndex = 1; + this.tv.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tv_BeforeExpand); + this.tv.Click += new System.EventHandler(this.tv_Click); + this.tv.SectionShouldClose += new Volian.Controls.Library.vlnTreeViewSectionInfoEvent(this.tv_SectionShouldClose); // // tv // @@ -618,6 +638,9 @@ namespace VEPROMS this.infoPanel.TitleStyle.GradientAngle = 90; this.infoPanel.TitleText = "Step Properties"; this.infoPanel.Click += new System.EventHandler(this.infoPanel_Click); + this.infoPanel.ExpandedChanged += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.infoPanel_ExpandedChanged); + this.infoPanel.Resize += new System.EventHandler(this.resizeVerticalExpandedPanel); + this.infoPanel.ExpandedChanging += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.expandPanelExpandedChanging); // // infoTabs // @@ -829,6 +852,7 @@ namespace VEPROMS this.expandableSplitter2.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; this.expandableSplitter2.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; this.expandableSplitter2.Dock = System.Windows.Forms.DockStyle.Bottom; + this.expandableSplitter2.Enabled = false; this.expandableSplitter2.ExpandFillColor = System.Drawing.Color.FromArgb(((int)(((byte)(167)))), ((int)(((byte)(173)))), ((int)(((byte)(182))))); this.expandableSplitter2.ExpandFillColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; this.expandableSplitter2.ExpandLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); @@ -862,6 +886,7 @@ namespace VEPROMS this.expandableSplitter3.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; this.expandableSplitter3.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; this.expandableSplitter3.Dock = System.Windows.Forms.DockStyle.Right; + this.expandableSplitter3.Enabled = false; this.expandableSplitter3.ExpandFillColor = System.Drawing.Color.FromArgb(((int)(((byte)(167)))), ((int)(((byte)(173)))), ((int)(((byte)(182))))); this.expandableSplitter3.ExpandFillColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; this.expandableSplitter3.ExpandLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); @@ -928,6 +953,8 @@ namespace VEPROMS this.toolsPanel.TitleStyle.GradientAngle = 90; this.toolsPanel.TitleText = "Tools"; this.toolsPanel.ExpandedChanged += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.toolsPanel_ExpandedChanged); + this.toolsPanel.Resize += new System.EventHandler(this.resizeVerticalExpandedPanel); + this.toolsPanel.ExpandedChanging += new DevComponents.DotNetBar.ExpandChangeEventHandler(this.expandPanelExpandedChanging); // // toolsTabs // @@ -1084,6 +1111,7 @@ namespace VEPROMS this.expandableSplitter4.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; this.expandableSplitter4.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; this.expandableSplitter4.Dock = System.Windows.Forms.DockStyle.Right; + this.expandableSplitter4.Enabled = false; this.expandableSplitter4.ExpandFillColor = System.Drawing.Color.FromArgb(((int)(((byte)(167)))), ((int)(((byte)(173)))), ((int)(((byte)(182))))); this.expandableSplitter4.ExpandFillColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; this.expandableSplitter4.ExpandLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); @@ -1152,7 +1180,7 @@ namespace VEPROMS this.Controls.Add(this.infoPanel); this.Controls.Add(this.expandableSplitter4); this.Controls.Add(this.toolsPanel); - this.Controls.Add(this.expandablePanel2); + this.Controls.Add(this.epProcedures); this.Controls.Add(this.epAnnotations); this.Controls.Add(this.bottomBar); this.Controls.Add(this.ribbonControl1); @@ -1163,7 +1191,7 @@ namespace VEPROMS this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmVEPROMS_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.bottomBar)).EndInit(); this.epAnnotations.ResumeLayout(false); - this.expandablePanel2.ResumeLayout(false); + this.epProcedures.ResumeLayout(false); this.infoPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.infoTabs)).EndInit(); this.infoTabs.ResumeLayout(false); @@ -1206,7 +1234,7 @@ namespace VEPROMS private DevComponents.DotNetBar.Bar bottomBar; private DevComponents.DotNetBar.ProgressBarItem bottomProgBar; private DevComponents.DotNetBar.ExpandablePanel epAnnotations; - private DevComponents.DotNetBar.ExpandablePanel expandablePanel2; + private DevComponents.DotNetBar.ExpandablePanel epProcedures; private DevComponents.DotNetBar.ExpandablePanel infoPanel; private Volian.Controls.Library.vlnTreeView tv; private DevComponents.DotNetBar.ExpandableSplitter expandableSplitter1; diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index b32fa7a3..d1ff98de 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -29,6 +29,7 @@ namespace VEPROMS private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); #endregion #region PropertiesVariables + private bool _panelExpandedChanging = false; Color _CommentTitleBckColor; DocVersionInfo _SelectedDVI = null; StepTabPanel _SelectedStepTabPanel=null; @@ -581,9 +582,9 @@ namespace VEPROMS /// private void btnOpen_Click(object sender, EventArgs e) { - if (!expandablePanel2.Expanded) // If panel not expanded - expand it. + if (!epProcedures.Expanded) // If panel not expanded - expand it. { - expandablePanel2.Expanded = true; + epProcedures.Expanded = true; if(tv.Nodes.Count > 0 && tv.SelectedNode==null) tv.SelectedNode = tv.Nodes[0]; tv.Focus(); @@ -597,7 +598,7 @@ namespace VEPROMS } private void btnNew_Click(object sender, EventArgs e) { - if (!expandablePanel2.Expanded) return; + if (!epProcedures.Expanded) return; VETreeNode vtn = tv.SelectedNode as VETreeNode; if (vtn == null) return; // nothing was selected. if (btnNew.SubItems.Count > 0) return; // submenu will be displayed @@ -1054,11 +1055,6 @@ namespace VEPROMS } } - private void toolsPanel_ExpandedChanged(object sender, ExpandedChangeEventArgs e) - { - if (toolsPanel.Expanded) - InitiateSearch(true); - } private void ribbonControl1_ExpandedChanged(object sender, EventArgs e) { Console.WriteLine("Size {0}",ribbonControl1.Expanded); @@ -1071,9 +1067,69 @@ namespace VEPROMS frmPropGrid pg = new frmPropGrid(tc.SelectedDisplayTabItem.SelectedItemInfo, tc.SelectedDisplayTabItem.SelectedItemInfo.Path); pg.Show(); } - private void expandablePanel2_ExpandedChanged(object sender, ExpandedChangeEventArgs e) + + private void epAnnotations_Resize(object sender, EventArgs e) { - expandableSplitter1.Enabled = expandablePanel2.Expanded; + if (epAnnotations.Expanded && !_panelExpandedChanging) + { + // if the height of the panel is smaller than the titleheight+20 + //(due to the user dragging the splitter down), then un-expand the + // panel and set the height to the titleheight+75 + if (epAnnotations.Size.Height < epAnnotations.TitleHeight + 20) + { + Size sz = new Size(epAnnotations.Size.Width, epAnnotations.TitleHeight + 75); + epAnnotations.Size = sz; + epAnnotations.Expanded = false; + } + } + } + + private void resizeVerticalExpandedPanel(object sender, EventArgs e) + { + ExpandablePanel ep = (ExpandablePanel)sender; + if (ep.Expanded && !_panelExpandedChanging) + { + // if the width of the panel is smaller than the titleheight+20 + //(due to the user dragging the splitter over), then un-expand the + // panel and set the width to the titleheight+50 + if (ep.Size.Width < ep.TitleHeight + 10) + { + Size sz = new Size(ep.TitleHeight + 50, ep.Size.Height); + ep.Size = sz; + ep.Expanded = false; + } + } + } + + private void expandPanelExpandedChanging(object sender, ExpandedChangeEventArgs e) + { + _panelExpandedChanging = true; + } + + private void toolsPanel_ExpandedChanged(object sender, ExpandedChangeEventArgs e) + { + _panelExpandedChanging = false; + expandableSplitter4.Enabled = toolsPanel.Expanded; + if (toolsPanel.Expanded) + InitiateSearch(true); + } + + private void epAnnotations_ExpandedChanged(object sender, ExpandedChangeEventArgs e) + { + _panelExpandedChanging = false; + expandableSplitter2.Enabled = epAnnotations.Expanded; + } + + private void epProcedures_ExpandedChanged(object sender, ExpandedChangeEventArgs e) + { + _panelExpandedChanging = false; + expandableSplitter1.Enabled = epProcedures.Expanded; + } + + private void infoPanel_ExpandedChanged(object sender, ExpandedChangeEventArgs e) + { + _panelExpandedChanging = false; + expandableSplitter3.Enabled = infoPanel.Expanded; } #endregion }