From e15fa3fb9193f6635b7f4ddec526c061a8ee03ed Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期五, 21 二月 2025 17:10:07 +0800
Subject: [PATCH] 添加了矩形断面 对于r的判断条件

---
 WinFrmUI/DPumpHydr.WinFrmUI.Volute/断面设计/ctrlSectionBundleInfo.cs |  513 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 441 insertions(+), 72 deletions(-)

diff --git "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ctrlSectionBundleInfo.cs" "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ctrlSectionBundleInfo.cs"
index c016c88..d545870 100644
--- "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ctrlSectionBundleInfo.cs"
+++ "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ctrlSectionBundleInfo.cs"
@@ -5,6 +5,7 @@
 using System.Drawing;
 using System.IO;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
@@ -23,26 +24,178 @@
             InitializeComponent();
             BuildAllTips();
             BuildIcon();
+
+            //skyTextBox鏂潰y18.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(8);
+            //};
+            //skyTextBox鏂潰r18.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(8);
+            //};
+            //skyTextBox鏂潰H18.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(8);
+            //};
+            crownLabelVIII.DoubleClick += (ss, ee) =>
+            {
+                HightLightSectCurve(8);
+            };
+
+            //skyTextBox鏂潰y17.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(7);
+            //};
+            //skyTextBox鏂潰r17.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(7);
+            //};
+            //skyTextBox鏂潰H17.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(7);
+            //};
+            crownLabelVII.DoubleClick += (ss, ee) =>
+            {
+                HightLightSectCurve(7);
+            };
+
+
+            //skyTextBox鏂潰y16.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(6);
+            //};
+            //skyTextBox鏂潰r16.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(6);
+            //};
+            //skyTextBox鏂潰H16.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(6);
+            //};
+            crownLabelVI.DoubleClick += (ss, ee) =>
+            {
+                HightLightSectCurve(6);
+            };
+
+            //skyTextBox鏂潰y15.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(5);
+            //};
+            //skyTextBox鏂潰r15.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(5);
+            //};
+            //skyTextBox鏂潰H15.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(5);
+            //};
+            crownLabelV.DoubleClick += (ss, ee) =>
+            {
+                HightLightSectCurve(5);
+            };
+
+            //skyTextBox鏂潰y14.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(4);
+            //};
+            //skyTextBox鏂潰r14.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(4);
+            //};
+            //skyTextBox鏂潰H14.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(4);
+            //};
+            crownLabelIV.DoubleClick += (ss, ee) =>
+            {
+                HightLightSectCurve(4);
+            };
+
+
+            //skyTextBox鏂潰y13.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(3);
+            //};
+            //skyTextBox鏂潰r13.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(3);
+            //};
+            //skyTextBox鏂潰H13.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(3);
+            //};
+            crownLabelIII.DoubleClick += (ss, ee) =>
+            {
+                HightLightSectCurve(3);
+            };
+
+
+            //skyTextBox鏂潰y12.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(2);
+            //};
+            //skyTextBox鏂潰r12.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(2);
+            //};
+            //skyTextBox鏂潰H12.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(2);
+            //};
+            crownLabelII.DoubleClick += (ss, ee) =>
+            {
+                HightLightSectCurve(2);
+            };
+
+            //skyTextBox鏂潰y11.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(1);
+            //};
+            //skyTextBox鏂潰r11.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(1);
+            //};
+            //skyTextBox鏂潰H11.Click += (ss, ee) =>
+            //{
+            //    HightLightSectCurve(1);
+            //};
+            crownLabelI.DoubleClick += (ss, ee) =>
+            {
+                HightLightSectCurve(1);
+            };
         }
+
         ViewModel.SectionBundleInfo _sectionBundleInfo = null;
         ViewModel.HdrBaseInfo _hdrBaseInfo = null;
         ViewModel.GeomBaseInfo _geomBaseInfo = null;
+        public void SetBindingData(ViewModel.SectionBundleInfo sectionBundle_info)
+        {
+            _sectionBundleInfo= sectionBundle_info;
+        }
 
 
         public void ShowPage(
             ViewModel.HdrBaseInfo base_info,
             ViewModel.GeomBaseInfo geom_info,
-            DPumpHydr.ViewModel.eWizardStepDiretion step_direction)
+            DPumpHydr.ViewModel.eWizardStepDiretion step_direction, bool isRefreshModel = true)
         {
             if (step_direction == DPumpHydr.ViewModel.eWizardStepDiretion.鍚庨��)
             {
                 return;
             }
-            this._hdrBaseInfo = base_info;
-            this._geomBaseInfo = geom_info;
-
+            if(_hdrBaseInfo == null && _geomBaseInfo == null)
+            {
+                _hdrBaseInfo = base_info;
+                _geomBaseInfo = geom_info;
+            }
+            if (isRefreshModel == false)
+            {
+                return;
+            }
             if (_sectionBundleInfo == null)
             {
+                this._hdrBaseInfo = base_info;
+                this._geomBaseInfo = geom_info;
                 _sectionBundleInfo = new ViewModel.SectionBundleInfo();
 
                 _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3;
@@ -52,15 +205,49 @@
             }
             else
             {
-                _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3;
-                _sectionBundleInfo.BaseCircleRadius = _geomBaseInfo.D3 / 2;
-                return;
-            }
+                if (Math.Abs(_sectionBundleInfo.BaseWidth - _geomBaseInfo.B3) < 1 &&
+                    Math.Abs(_sectionBundleInfo.BaseCircleRadius - _geomBaseInfo.D3 / 2) < 1 )
+                {
 
+                    _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3;
+                    _sectionBundleInfo.BaseCircleRadius = _geomBaseInfo.D3 / 2;
+                    if (_hdrBaseInfo.n != base_info.n || _hdrBaseInfo.Q != base_info.Q || _hdrBaseInfo.H != base_info.H || _hdrBaseInfo.IsSXB != base_info.IsSXB)
+                    {
+                        this._hdrBaseInfo = base_info;
+                        this._geomBaseInfo = geom_info;
+                        _sectionBundleInfo.InitialK3(this._hdrBaseInfo, this._geomBaseInfo);
+                        RefreshAllSectPara(_sectionBundleInfo);
+                        _sectionBundleInfo.RecalculateArea(this._hdrBaseInfo, this._geomBaseInfo);
+
+                        RefrehSectBundlePara();
+
+
+                        if (OnRefreshShape != null)
+                        {
+                            ViewModel.SectionBundleInfo paras = GetBindingData(out string error);
+                            if (paras == null)
+                                return;
+                            //textBox鍓茶垖瑙掑害
+                            OnRefreshShape.Invoke(paras);
+                        }
+                        //RefreshShape(_sectionBundleInfo);
+                    }
+                    else
+                    {
+                        this._hdrBaseInfo = base_info;
+                        this._geomBaseInfo = geom_info;
+                        RefreshShape(_sectionBundleInfo);
+                    }
+
+                    return;
+                }
+            }
 
             RefreshAllSectPara(_sectionBundleInfo);
 
-            this.OnRefreshShape(_sectionBundleInfo);
+            
+
+            RefreshShape(_sectionBundleInfo);
         }
         private void pictureBoxRefreshK3_Click(object sender, EventArgs e)
         {
@@ -76,6 +263,8 @@
             this.textBoxK3.Text = _sectionBundleInfo.K3.ToString();
             this.textBoxV3.Text = _sectionBundleInfo.V3.ToString();
 
+
+            RefrehSectBundlePara();
             if (_sectionBundleInfo.ShapeType == eSectionShapeType.瀵圭О)
             {
                 RBtn鏂潰瀵圭О姊舰.Checked = true;
@@ -94,49 +283,24 @@
                 RBtn涓嶅绉版褰�.Checked = false;
                 RBtn鐭╁舰.Checked = true;
             }
-
-            RefrehPara();
         }
         //鏀归潰绉�
-        public void RefreshSingleSectArea(  int sectIndex,double area)
+        public void RefreshSingleSectArea(int sectIndex, double area)
         {
             if (this._sectionBundleInfo == null)
                 return;
             this._sectionBundleInfo.Area[sectIndex] = area;
             this._sectionBundleInfo.CalcHeightByArea(_geomBaseInfo, sectIndex);
 
-            RefrehPara();
+            RefrehSectBundlePara();
 
             if (OnRefreshShape == null)
-                return; 
+                return;
             OnRefreshShape.Invoke(_sectionBundleInfo);
         }
 
 
-        private void RefrehPara()
-        {
-            for (var argument = 1; argument <= 8; argument++)
-            {
-                var controlnameGama1 = $"skyTextBox鏂潰y1{argument}";
-                var controlnameRia1 = $"skyTextBox鏂潰r1{argument}";
-                var controlname鏂潰闈㈢Н = $"skyTextBox鏂潰闈㈢Н{argument}";
-                var controlnameHeight = $"skyTextBox鏂潰H1{argument}";
 
-                SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox;
-                SkyTextBox controly2 = this.Controls.Find(controlnameRia1, true).FirstOrDefault() as SkyTextBox;
-                SkyTextBox control鏂潰闈㈢Н = this.Controls.Find(controlname鏂潰闈㈢Н, true).FirstOrDefault() as SkyTextBox;
-                SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox;
-
-                if (controly1 != null)
-                    controly1.Text = _sectionBundleInfo.GaMa_Left[argument].ToString();
-                if (controly2 != null)
-                    controly2.Text = _sectionBundleInfo.R_Left[argument].ToString();
-                if (control鏂潰闈㈢Н != null)
-                    control鏂潰闈㈢Н.Text = _sectionBundleInfo.Area[argument].ToString();
-                if (controH1 != null)
-                    controH1.Text = _sectionBundleInfo.H[argument].ToString();
-            }
-        }
         public ViewModel.SectionBundleInfo GetBindingData(out string error)
         {
             if (!Verify(out error))
@@ -164,13 +328,15 @@
 
             _sectionBundleInfo.V3 = Convert.ToDouble(this.textBoxV3.Text);
             for (var argument = 1; argument <= 8; argument++)
-            {
+            {//skyTextBox鏂潰H18
                 var controlname_y1 = $"skyTextBox鏂潰y1{argument}";
                 var controlname_r1 = $"skyTextBox鏂潰r1{argument}";
                 var controlname鏂潰闈㈢Н = $"skyTextBox鏂潰闈㈢Н{argument}";
+                var controlnameh = $"skyTextBox鏂潰H1{argument}";
                 SkyTextBox controlY1 = this.Controls.Find(controlname_y1, true).FirstOrDefault() as SkyTextBox;
                 SkyTextBox controlR1 = this.Controls.Find(controlname_r1, true).FirstOrDefault() as SkyTextBox;
                 SkyTextBox control鏂潰闈㈢Н = this.Controls.Find(controlname鏂潰闈㈢Н, true).FirstOrDefault() as SkyTextBox;
+                SkyTextBox controlH = this.Controls.Find(controlnameh, true).FirstOrDefault() as SkyTextBox;
                 if (controlY1 != null)
                 {
                     _sectionBundleInfo.GaMa_Left[argument] = Convert.ToDouble(controlY1.Text);
@@ -185,6 +351,8 @@
 
                 if (control鏂潰闈㈢Н != null)
                     _sectionBundleInfo.Area[argument] = Convert.ToDouble(control鏂潰闈㈢Н.Text);
+                if (controlH != null)
+                    _sectionBundleInfo.H[argument] = Convert.ToDouble(controlH.Text);
             }
 
 
@@ -200,13 +368,13 @@
                 error = "璇疯緭鍏ュ繀濉」锛�";
                 isOk = false;
             }
-            if (string.IsNullOrEmpty(skyTextBox鏂潰y18.Text) || double.Parse(skyTextBox鏂潰y18.Text) <= 0)
+            if (string.IsNullOrEmpty(skyTextBox鏂潰y18.Text) || (!RBtn鐭╁舰.Checked && double.Parse(skyTextBox鏂潰y18.Text) == 0)|| double.Parse(skyTextBox鏂潰y18.Text) < 0)
             {
                 error = "璇疯緭鍏ュ繀濉」锛�";
                 isOk = false;
 
             }
-            if (string.IsNullOrEmpty(skyTextBox鏂潰r18.Text) || double.Parse(skyTextBox鏂潰r18.Text) <= 0)
+            if (string.IsNullOrEmpty(skyTextBox鏂潰r18.Text) || (!RBtn鐭╁舰.Checked && double.Parse(skyTextBox鏂潰r18.Text) == 0)|| double.Parse(skyTextBox鏂潰y18.Text) < 0)
             {
                 error = "璇疯緭鍏ュ繀濉」锛�";
                 isOk = false;
@@ -254,11 +422,11 @@
 
         private void BuildAllTips()
         {
-            metroToolTip绗笁姝ユ彁绀�.SetToolTip(this.metroTile瀵圭О姊舰, "瀵圭О姊舰");
-            metroToolTip绗笁姝ユ彁绀�.SetToolTip(this.metroTile涓嶅绉版褰�, "涓嶅绉版褰�");
-            metroToolTip绗笁姝ユ彁绀�.SetToolTip(this.metroTile鐭╁舰, "鐭╁舰");
-            metroToolTip绗笁姝ユ彁绀�.SetToolTip(this.skyTextBox鏂潰y18, "y1 瑙i噴");
-            metroToolTip绗笁姝ユ彁绀�.SetToolTip(this.skyTextBox鏂潰r18, "y2 瑙i噴");
+            //metroToolTip鎻愮ず.SetToolTip(this.metroTile瀵圭О姊舰, "瀵圭О姊舰");
+            //metroToolTip鎻愮ず.SetToolTip(this.metroTile涓嶅绉版褰�, "涓嶅绉版褰�");
+            //metroToolTip鎻愮ず.SetToolTip(this.metroTile鐭╁舰, "鐭╁舰");
+            //metroToolTip鎻愮ず.SetToolTip(this.skyTextBox鏂潰y18, "y1 瑙i噴");
+            //metroToolTip鎻愮ず.SetToolTip(this.skyTextBox鏂潰r18, "y2 瑙i噴");
         }
         private void metroTile鏂潰褰㈢姸1_Click(object sender, EventArgs e)
         {
@@ -287,22 +455,84 @@
 
         private void skyTextBox鏂潰VIIIy1_TextChanged(object sender, EventArgs e)
         {
+            if (sender is SkyTextBox skytextBox)
             {
-                if (!double.TryParse(skyTextBox鏂潰y18.Text, out double result) && !string.IsNullOrEmpty(skyTextBox鏂潰y18.Text))
+                string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString();
+                int index = Convert.ToInt32(lastChar);
+                if (!double.TryParse(skytextBox.Text, out double result) && !string.IsNullOrEmpty(skytextBox.Text))
                 {
-                    skyTextBox鏂潰y18.Text = _sectionBundleInfo.GaMa_Left[8].ToString();
+                    skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString();
                 }
             }
         }
 
         private void skyTextBox鏂潰VIIIy2_TextChanged(object sender, EventArgs e)
         {
+            if (sender is SkyTextBox skytextBox)
             {
-                if (!double.TryParse(skyTextBox鏂潰r18.Text, out double result) && !string.IsNullOrEmpty(skyTextBox鏂潰r18.Text))
+                string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString();
+                int index = Convert.ToInt32(lastChar);
+                if (!double.TryParse(skytextBox.Text, out double result) && !string.IsNullOrEmpty(skytextBox.Text))
                 {
-                    skyTextBox鏂潰r18.Text = _sectionBundleInfo.GaMa_Right[8].ToString();
+                    skytextBox.Text = _sectionBundleInfo.GaMa_Right[index].ToString();
+                }
+                if (string.IsNullOrEmpty(skytextBox.Text))
+                {
+                    MessageBox.Show("r涓嶅悎鐞嗭紒璇烽噸鏂拌緭鍏�");
+                }
+
+                if (Convert.ToDouble(skytextBox.Text) != _sectionBundleInfo.R_Left[index])
+                {
+                    Judgment_R(index);
+                }
+                else
+                {
+                    skytextBox.BackColor = Color.White;
                 }
             }
+
+        }
+
+        public bool Judgment_R(int index)
+        {
+            bool isreasonable = true;
+            SkyTextBox controlr1 = this.Controls.Find($"skyTextBox鏂潰r1{index}", true).FirstOrDefault() as SkyTextBox;
+            SkyTextBox controlGaMa1 = this.Controls.Find($"skyTextBox鏂潰y1{index}", true).FirstOrDefault() as SkyTextBox;
+            SkyTextBox controlh1 = this.Controls.Find($"skyTextBox鏂潰H1{index}", true).FirstOrDefault() as SkyTextBox;
+            if (RBtn鐭╁舰.Checked)
+            {
+                if (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) < 1|| _sectionBundleInfo.BaseWidth- (Convert.ToDouble(controlr1.Text)*2) < 1)
+                {
+                    controlr1.BackColor = Color.OrangeRed;
+                    MessageBox.Show("r涓嶅悎鐞嗭紒璇烽噸鏂拌緭鍏�");
+                }
+                else
+                {
+                    controlr1.BackColor = Color.White;
+                }
+            }
+            else
+            {
+                //鐩墠杩欎釜鍙娴嬪绉扮殑 //鑻ヤ笉瀵圭О鏇存崲鍗婂緞瑙掑害绛夊弬鏁伴噸鏂拌绠楀彟涓�杈箈
+                var x = Math.Tan(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Convert.ToDouble(controlh1.Text)
+                             - (Math.Tan(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Math.Tan(Convert.ToDouble(controlGaMa1.Text) / 2 * Math.PI / 180) * Convert.ToDouble(controlr1.Text))
+                             - (Math.Tan(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Convert.ToDouble(controlr1.Text)) - Convert.ToDouble(controlr1.Text);
+                var c = _sectionBundleInfo.R_out / 1000;
+                var TopWidth = _sectionBundleInfo.BaseWidth + (2 * x);
+                var Slash = (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) - (Math.Sin(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Convert.ToDouble(controlr1.Text))) / Math.Cos(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180);
+                if ((!RBtn鐭╁舰.Checked && (TopWidth < c || Slash < c)) || Convert.ToDouble(controlr1.Text) == 0)
+                {
+                    controlr1.BackColor = Color.OrangeRed;
+                    MessageBox.Show("r涓嶅悎鐞嗭紒璇烽噸鏂拌緭鍏�");
+                }
+                else
+                {
+                    controlr1.BackColor = Color.White;
+                }
+            }
+            
+
+            return isreasonable;
         }
 
 
@@ -320,9 +550,9 @@
                 _sectionBundleInfo = new ViewModel.SectionBundleInfo();
             }
             _sectionBundleInfo.V3 = v3;
-            _sectionBundleInfo.CalcParaV3(this._hdrBaseInfo, this._geomBaseInfo);
+            _sectionBundleInfo.RecalculateArea(this._hdrBaseInfo, this._geomBaseInfo);
 
-            RefrehPara();
+            RefrehSectBundlePara();
 
 
             if (OnRefreshShape != null)
@@ -338,27 +568,29 @@
 
         private void mlBtn鏇存敼鏂潰瑙掑害_Click(object sender, EventArgs e)
         {
-            if (!RBtn鏂潰瀵圭О姊舰.Checked && !RBtn涓嶅绉版褰�.Checked && !RBtn鐭╁舰.Checked)
-            {
-                MessageBox.Show("璇峰厛閫夋嫨鏂潰绫诲瀷锛�");
-                return;
-            }
-            if (string.IsNullOrEmpty(skyTextBox鏂潰y18.Text) || string.IsNullOrEmpty(skyTextBox鏂潰r18.Text))
-            {
-                //skyLabel鎻愮ずy2.Visible = false;
-                //skyLabel鎻愮ずy1.Visible = false;
-                //skyLabely1.Visible = true;
-                //skyLabely2.Visible = true;
-                //MessageBox.Show("璇峰厛杈撳叆y1銆亂2锛�");
-                return;
-            }
+            //if (!RBtn鏂潰瀵圭О姊舰.Checked && !RBtn涓嶅绉版褰�.Checked && !RBtn鐭╁舰.Checked)
+            //{
+            //    MessageBox.Show("璇峰厛閫夋嫨鏂潰绫诲瀷锛�");
+            //    return;
+            //}
+            //if (string.IsNullOrEmpty(skyTextBox鏂潰y18.Text) || string.IsNullOrEmpty(skyTextBox鏂潰r18.Text))
+            //{
+            //    //skyLabel鎻愮ずy2.Visible = false;
+            //    //skyLabel鎻愮ずy1.Visible = false;
+            //    //skyLabely1.Visible = true;
+            //    //skyLabely2.Visible = true;
+            //    //MessageBox.Show("璇峰厛杈撳叆y1銆亂2锛�");
+            //    return;
+            //}
         }
 
         private void RBtn鏂潰瀵圭О姊舰_CheckedChanged(object sender)
         {
             if (RBtn鏂潰瀵圭О姊舰.Checked)
             {
-                skyTextBox鏂潰y18.Enabled = true;
+                RefrehSectBundlePara();
+                RefreshShape(_sectionBundleInfo);
+                //skyTextBox鏂潰y18.Enabled = true;
                 //skyTextBox鏂潰r18.Enabled = false;
             }
         }
@@ -367,7 +599,9 @@
         {
             if (RBtn涓嶅绉版褰�.Checked)
             {
-                skyTextBox鏂潰y18.Enabled = true;
+                RefrehSectBundlePara();
+                RefreshShape(_sectionBundleInfo);
+                //skyTextBox鏂潰y18.Enabled = true;
                 //skyTextBox鏂潰r18.Enabled = true;
             }
         }
@@ -387,18 +621,153 @@
             this.textBoxV3.Text = Math.Round(K3 * Math.Sqrt(2 * g * _hdrBaseInfo.Q), 2).ToString();
         }
 
-        public Action<ViewModel.SectionBundleInfo> OnRefreshShape = null;
+        public Func<ViewModel.SectionBundleInfo, List<int>> OnRefreshShape = null;
         private void mBtn鏇存柊妯″瀷_Click(object sender, EventArgs e)
         {
             ViewModel.SectionBundleInfo paras = GetBindingData(out string error);
             if (paras == null)
                 return;
-            if (OnRefreshShape == null)
-                return;
-            //paras.InitialAllParameters(this._hdrBaseInfo,this._geomBaseInfo);
-            OnRefreshShape.Invoke(paras);
+
+            RefreshShape(paras);
+
         }
 
+        private void RefreshShape(ViewModel.SectionBundleInfo paras)
+        {
+            if (OnRefreshShape == null)
+                return;
+            var error_sects = OnRefreshShape.Invoke(paras);
 
+            for (var sect_index = 1; sect_index <= 8; sect_index++)
+            {
+                var controlnameGama1 = $"skyTextBox鏂潰y1{sect_index}";
+                var controlnameRia1 = $"skyTextBox鏂潰r1{sect_index}";
+                var controlname鏂潰闈㈢Н = $"skyTextBox鏂潰闈㈢Н{sect_index}";
+                var controlnameHeight = $"skyTextBox鏂潰H1{sect_index}";
+
+                SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox;
+                SkyTextBox controly2 = this.Controls.Find(controlnameRia1, true).FirstOrDefault() as SkyTextBox;
+                SkyTextBox control鏂潰闈㈢Н = this.Controls.Find(controlname鏂潰闈㈢Н, true).FirstOrDefault() as SkyTextBox;
+                SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox;
+
+
+                if (error_sects != null && error_sects.Contains(sect_index))
+                {
+                    controly1.BackColor = Color.OrangeRed;
+                    controly2.BackColor = Color.OrangeRed;
+                    control鏂潰闈㈢Н.BackColor = Color.OrangeRed;
+                    controH1.BackColor = Color.OrangeRed;
+                }
+                else
+                {
+                    controly1.BackColor = Color.White;
+                    controly2.BackColor = Color.White;
+                    control鏂潰闈㈢Н.BackColor = Color.White;
+                    controH1.BackColor = Color.White;
+                }
+            }
+        }
+        public Action<int> OnHightLightSectCurve = null;
+        private void HightLightSectCurve(int sectIndex)
+        {
+            if (OnHightLightSectCurve != null)
+                OnHightLightSectCurve.Invoke(sectIndex);
+        }
+
+        private void RefrehSectBundlePara()
+        {
+            for (var sect_index = 1; sect_index <= 8; sect_index++)
+            {
+                var controlnameGama1 = $"skyTextBox鏂潰y1{sect_index}";
+                var controlnameRia1 = $"skyTextBox鏂潰r1{sect_index}";
+                var controlname鏂潰闈㈢Н = $"skyTextBox鏂潰闈㈢Н{sect_index}";
+                var controlnameHeight = $"skyTextBox鏂潰H1{sect_index}";
+
+                SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox;
+                SkyTextBox controly2 = this.Controls.Find(controlnameRia1, true).FirstOrDefault() as SkyTextBox;
+                SkyTextBox control鏂潰闈㈢Н = this.Controls.Find(controlname鏂潰闈㈢Н, true).FirstOrDefault() as SkyTextBox;
+                SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox;
+
+                controly1.Enabled = true;
+                if (controly1 != null)
+                    controly1.Text = _sectionBundleInfo.GaMa_Left[sect_index].ToString();
+                if (controly2 != null)
+                    controly2.Text = _sectionBundleInfo.R_Left[sect_index].ToString();
+                if (control鏂潰闈㈢Н != null)
+                    control鏂潰闈㈢Н.Text = _sectionBundleInfo.Area[sect_index].ToString();
+                if (controH1 != null)
+                    controH1.Text = _sectionBundleInfo.H[sect_index].ToString();
+            }
+        }
+
+        private void skyTextBox鏂潰r17_TextChanged(object sender, EventArgs e)
+        {
+            if (!double.TryParse(skyTextBox鏂潰r17.Text, out double result) && !string.IsNullOrEmpty(skyTextBox鏂潰r17.Text))
+            {
+                skyTextBox鏂潰r17.Text = _sectionBundleInfo.GaMa_Right[7].ToString();
+            }
+            if (string.IsNullOrEmpty(skyTextBox鏂潰r17.Text))
+            {
+                MessageBox.Show("r涓嶅悎鐞嗭紒璇烽噸鏂拌緭鍏�");
+            }
+            if (Convert.ToDouble(skyTextBox鏂潰r17.Text) != _sectionBundleInfo.R_Left[7])
+            {
+                Judgment_R(7);
+            }
+        }
+
+        private void skyTextBox鏂潰y11_Enter(object sender, EventArgs e)
+        {
+            if (sender is SkyTextBox skytextBox)
+            {
+                string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString();
+                int index = Convert.ToInt32(lastChar);
+                HightLightSectCurve(index);
+            }
+        }
+
+        private void btnNextStep_Click(object sender, EventArgs e)
+        {
+            NextStep();
+        }
+
+        private void RBtn鐭╁舰_CheckedChanged(object sender)
+        {
+            if (RBtn鐭╁舰.Checked)
+            {
+                //for (var sect_index = 1; sect_index <= 8; sect_index++)
+                //{
+                //    var controlnameGama1 = $"skyTextBox鏂潰y1{sect_index}";
+                //    SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox;
+                //    controly1.Text = "0";
+                //    controly1.Enabled = false;
+                //}
+                ViewModel.SectionBundleInfo Rec_sectionBundleInfo = _sectionBundleInfo.Copy();
+                Rec_sectionBundleInfo.ShapeType = eSectionShapeType.鐭╁舰;
+                Rec_sectionBundleInfo.ResetAllParas(_hdrBaseInfo, _geomBaseInfo);
+                for (var sect_index = 1; sect_index <= 8; sect_index++)
+                {
+                    var controlnameGama1 = $"skyTextBox鏂潰y1{sect_index}";
+                    var controlnameRia1 = $"skyTextBox鏂潰r1{sect_index}";
+                    var controlname鏂潰闈㈢Н = $"skyTextBox鏂潰闈㈢Н{sect_index}";
+                    var controlnameHeight = $"skyTextBox鏂潰H1{sect_index}";
+
+                    SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox;
+                    SkyTextBox controly2 = this.Controls.Find(controlnameRia1, true).FirstOrDefault() as SkyTextBox;
+                    SkyTextBox control鏂潰闈㈢Н = this.Controls.Find(controlname鏂潰闈㈢Н, true).FirstOrDefault() as SkyTextBox;
+                    SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox;
+                    controly1.Enabled = false;
+                    if (controly1 != null)
+                        controly1.Text = Rec_sectionBundleInfo.GaMa_Left[sect_index].ToString();
+                    if (controly2 != null)
+                        controly2.Text = Rec_sectionBundleInfo.R_Left[sect_index].ToString();
+                    if (control鏂潰闈㈢Н != null)
+                        control鏂潰闈㈢Н.Text = Rec_sectionBundleInfo.Area[sect_index].ToString();
+                    if (controH1 != null)
+                        controH1.Text = Rec_sectionBundleInfo.H[sect_index].ToString();
+                }
+                RefreshShape(Rec_sectionBundleInfo);
+            }
+        }
     }
 }

--
Gitblit v1.9.3