yangyin
2025-02-21 e15fa3fb9193f6635b7f4ddec526c061a8ee03ed
WinFrmUI/DPumpHydr.WinFrmUI.Volute/¶ÏÃæÉè¼Æ/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,69 +24,283 @@
            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 _paras = null;
        ViewModel.SectionBundleInfo _sectionBundleInfo = null;
        ViewModel.HdrBaseInfo _hdrBaseInfo = null;
        ViewModel.GeomBaseInfo _geomBaseInfo = null;
        public void InitialParas(HdrBaseInfo BaseInfo, GeomBaseInfo geom_info)
        public void SetBindingData(ViewModel.SectionBundleInfo sectionBundle_info)
        {
            this._hdrBaseInfo = BaseInfo;
            this._geomBaseInfo = geom_info;
            _sectionBundleInfo= sectionBundle_info;
        }
        public void SetBindingData(ViewModel.SectionBundleInfo vm)
        public void ShowPage(
            ViewModel.HdrBaseInfo base_info,
            ViewModel.GeomBaseInfo geom_info,
            DPumpHydr.ViewModel.eWizardStepDiretion step_direction, bool isRefreshModel = true)
        {
            this._paras = vm;
            if (vm == null)
            if (step_direction == DPumpHydr.ViewModel.eWizardStepDiretion.后退)
            {
                return;
            }
            this.mTextBoxEdit蜗室平均速度.Text = vm.V3.ToString();
            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();
            if (_paras.ShapeType == eSectionShapeType.对称)
                _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3;
                _sectionBundleInfo.BaseCircleRadius = _geomBaseInfo.D3 / 2;
                _sectionBundleInfo.ResetAllParas(_hdrBaseInfo, _geomBaseInfo);
            }
            else
            {
                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);
            RefreshShape(_sectionBundleInfo);
        }
        private void pictureBoxRefreshK3_Click(object sender, EventArgs e)
        {
            _sectionBundleInfo.InitialK3(this._hdrBaseInfo, this._geomBaseInfo);
            RefreshAllSectPara(_sectionBundleInfo);
        }
        //
        public void RefreshAllSectPara(ViewModel.SectionBundleInfo paras)
        {
            this._sectionBundleInfo = paras;
            this.textBoxK3.Text = _sectionBundleInfo.K3.ToString();
            this.textBoxV3.Text = _sectionBundleInfo.V3.ToString();
            RefrehSectBundlePara();
            if (_sectionBundleInfo.ShapeType == eSectionShapeType.对称)
            {
                RBtn断面对称梯形.Checked = true;
                RBtn不对称梯形.Checked = false;
                RBtn矩形.Checked = false;
            }
            if (_paras.ShapeType == eSectionShapeType.不对称)
            if (_sectionBundleInfo.ShapeType == eSectionShapeType.不对称)
            {
                RBtn断面对称梯形.Checked = false;
                RBtn不对称梯形.Checked = true;
                RBtn矩形.Checked = false;
            }
            if (_paras.ShapeType == eSectionShapeType.矩形)
            if (_sectionBundleInfo.ShapeType == eSectionShapeType.矩形)
            {
                RBtn断面对称梯形.Checked = false;
                RBtn不对称梯形.Checked = false;
                RBtn矩形.Checked = true;
            }
            RefrehPara();
        }
        private void RefrehPara()
        //改面积
        public void RefreshSingleSectArea(int sectIndex, double area)
        {
            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}";
            if (this._sectionBundleInfo == null)
                return;
            this._sectionBundleInfo.Area[sectIndex] = area;
            this._sectionBundleInfo.CalcHeightByArea(_geomBaseInfo, sectIndex);
                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;
            RefrehSectBundlePara();
                if (controly1 != null)
                    controly1.Text = _paras.GaMa_Left[argument].ToString();
                if (controly2 != null)
                    controly2.Text = _paras.R_Left[argument].ToString();
                if (control断面面积 != null)
                    control断面面积.Text = _paras.Area[argument].ToString();
                if (controH1 != null)
                    controH1.Text = _paras.H[argument].ToString();
            }
            if (OnRefreshShape == null)
                return;
            OnRefreshShape.Invoke(_sectionBundleInfo);
        }
        public ViewModel.SectionBundleInfo GetBindingData(out string error)
        {
            if (!Verify(out error))
@@ -93,70 +308,73 @@
                return null;
            }
            error = null;
            if (_paras == null)
            if (_sectionBundleInfo == null)
            {
                _paras = new ViewModel.SectionBundleInfo();
                _sectionBundleInfo = new ViewModel.SectionBundleInfo();
            }
            if (RBtn断面对称梯形.Checked)
            {
                _paras.ShapeType = eSectionShapeType.对称;
                _sectionBundleInfo.ShapeType = eSectionShapeType.对称;
            }
            if (RBtn不对称梯形.Checked)
            {
                _paras.ShapeType = eSectionShapeType.不对称;
                _sectionBundleInfo.ShapeType = eSectionShapeType.不对称;
            }
            if (RBtn矩形.Checked)
            {
                _paras.ShapeType = eSectionShapeType.矩形;
                _sectionBundleInfo.ShapeType = eSectionShapeType.矩形;
            }
            _paras.V3 = Convert.ToDouble(this.mTextBoxEdit蜗室平均速度.Text);
            _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)
                {
                    _paras.GaMa_Left[argument] = Convert.ToDouble(controlY1.Text);
                    _paras.GaMa_Right[argument] = _paras.GaMa_Left[argument];
                    _sectionBundleInfo.GaMa_Left[argument] = Convert.ToDouble(controlY1.Text);
                    _sectionBundleInfo.GaMa_Right[argument] = _sectionBundleInfo.GaMa_Left[argument];
                }
                if (controlR1 != null)
                {
                    _paras.R_Left[argument] = Convert.ToDouble(controlR1.Text);
                    _paras.R_Right[argument] = _paras.R_Left[argument];
                    _sectionBundleInfo.R_Left[argument] = Convert.ToDouble(controlR1.Text);
                    _sectionBundleInfo.R_Right[argument] = _sectionBundleInfo.R_Left[argument];
                }
                if (control断面面积 != null)
                    _paras.Area[argument] = Convert.ToDouble(control断面面积.Text);
            }
            return _paras;
                if (control断面面积 != null)
                    _sectionBundleInfo.Area[argument] = Convert.ToDouble(control断面面积.Text);
                if (controlH != null)
                    _sectionBundleInfo.H[argument] = Convert.ToDouble(controlH.Text);
            }
            return _sectionBundleInfo;
        }
        public bool Verify(out string error)
        {
            error = "";
            bool isOk = true;
            if (string.IsNullOrEmpty(mTextBoxEdit蜗室平均速度.Text) || double.Parse(mTextBoxEdit蜗室平均速度.Text) == 0)
            double v3 = 0;
            if (string.IsNullOrEmpty(textBoxV3.Text) || !double.TryParse(textBoxV3.Text, out v3) || v3 <= 0.1)
            {
                error = "请输入必填项!";
                isOk = false;
                mTextBoxEdit蜗室平均速度.TrailingIcon = GlobalResource.GetTipTrailingIcon();
                skyLabel蜗室平均速度.Visible = true;
            }
            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;
@@ -166,27 +384,27 @@
        public bool IsParameterChange()
        {
            if (double.Parse(mTextBoxEdit蜗室平均速度.Text) != this._paras.V3)
            if (double.Parse(textBoxV3.Text) != this._sectionBundleInfo.V3)
            {
                return true;
            }
            if (RBtn断面对称梯形.Checked && this._paras.ShapeType == eSectionShapeType.对称)
            if (RBtn断面对称梯形.Checked && this._sectionBundleInfo.ShapeType == eSectionShapeType.对称)
            {
                return true;
            }
            if (RBtn不对称梯形.Checked && this._paras.ShapeType == eSectionShapeType.不对称)
            if (RBtn不对称梯形.Checked && this._sectionBundleInfo.ShapeType == eSectionShapeType.不对称)
            {
                return true;
            }
            if (RBtn矩形.Checked && this._paras.ShapeType == eSectionShapeType.矩形)
            if (RBtn矩形.Checked && this._sectionBundleInfo.ShapeType == eSectionShapeType.矩形)
            {
                return true;
            }
            if (double.Parse(skyTextBox断面y18.Text) != this._paras.GaMa_Left[8])
            if (double.Parse(skyTextBox断面y18.Text) != this._sectionBundleInfo.GaMa_Left[8])
            {
                return true;
            }
            if (double.Parse(skyTextBox断面r18.Text) != this._paras.GaMa_Right[8])
            if (double.Parse(skyTextBox断面r18.Text) != this._sectionBundleInfo.GaMa_Right[8])
            {
                return true;
            }
@@ -196,9 +414,6 @@
        private void BuildIcon()
        {
            //对话框前缀图片
            mTextBoxEdit蜗室平均速度.LeadingIcon = GlobalResource.GetLeadingIcon();
            //断面形状图片
            metroTile对称梯形.BackgroundImage = GlobalResource.BuildImage("duichentixing.png", 97, 88);
            metroTile不对称梯形.BackgroundImage = GlobalResource.BuildImage("buduichentixing.png", 97, 88);
@@ -207,19 +422,17 @@
        private void BuildAllTips()
        {
            metroToolTip第三步提示.SetToolTip(this.metroTile对称梯形, "对称梯形");
            metroToolTip第三步提示.SetToolTip(this.metroTile不对称梯形, "不对称梯形");
            metroToolTip第三步提示.SetToolTip(this.metroTile矩形, "矩形");
            metroToolTip第三步提示.SetToolTip(this.mTextBoxEdit蜗室平均速度, "液体在蜗室内流动\n时的平均速度");
            metroToolTip第三步提示.SetToolTip(this.skyTextBox断面y18, "y1 è§£é‡Š");
            metroToolTip第三步提示.SetToolTip(this.skyTextBox断面r18, "y2 è§£é‡Š");
            //metroToolTip提示.SetToolTip(this.metroTile对称梯形, "对称梯形");
            //metroToolTip提示.SetToolTip(this.metroTile不对称梯形, "不对称梯形");
            //metroToolTip提示.SetToolTip(this.metroTile矩形, "矩形");
            //metroToolTip提示.SetToolTip(this.skyTextBox断面y18, "y1 è§£é‡Š");
            //metroToolTip提示.SetToolTip(this.skyTextBox断面r18, "y2 è§£é‡Š");
        }
        private void metroTile断面形状1_Click(object sender, EventArgs e)
        {
            RBtn断面对称梯形.Checked = true;
            RBtn不对称梯形.Checked = false;
            RBtn矩形.Checked = false;
        }
        private void metroTile断面形状2_Click(object sender, EventArgs e)
@@ -236,118 +449,149 @@
            RBtn矩形.Checked = true;
        }
        private void mTextBoxEdit蜗室平均速度_Enter(object sender, EventArgs e)
        {
            skyLabel蜗室平均速度.Visible = false;
            mTextBoxEdit蜗室平均速度.TrailingIcon = null;
        }
        private void mTextBoxEdit蜗室平均速度_Leave(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(mTextBoxEdit蜗室平均速度.Text) || double.Parse(mTextBoxEdit蜗室平均速度.Text) == 0)
            {
                mTextBoxEdit蜗室平均速度.Text = _paras.V3.ToString();
            }
        }
        private void mTextBoxEdit蜗室平均速度_TextChanged(object sender, EventArgs e)
        {
            foreach (var s in mTextBoxEdit蜗室平均速度.Text)
            {
                if (!double.TryParse(mTextBoxEdit蜗室平均速度.Text, out double result) && !string.IsNullOrEmpty(mTextBoxEdit蜗室平均速度.Text))
                {
                    mTextBoxEdit蜗室平均速度.UseAccent = true;
                    mTextBoxEdit蜗室平均速度.ShowAssistiveText = true;
                    mTextBoxEdit蜗室平均速度.Text = "";
                    break;
                }
                else
                {
                    mTextBoxEdit蜗室平均速度.ShowAssistiveText = false;
                    mTextBoxEdit蜗室平均速度.UseAccent = false;
                }
            }
        }
        private void skyTextBox断面VIIIy1_TextChanged(object sender, EventArgs e)
        {
            foreach (var s in skyTextBox断面y18.Text)
            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 = _paras.GaMa_Left[8].ToString();
                    break;
                    skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString();
                }
            }
        }
        private void skyTextBox断面VIIIy2_TextChanged(object sender, EventArgs e)
        {
            foreach (var s in skyTextBox断面r18.Text)
            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 = _paras.GaMa_Right[8].ToString();
                    //skyLabel提示y2.Visible = true;
                    break;
                    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;
                }
            }
        }
        private void skyTextBox断面VIIIy1_Enter(object sender, EventArgs e)
        {
        }
        private void skyTextBox断面VIIIy2_Enter(object sender, EventArgs e)
        public bool Judgment_R(int index)
        {
            //skyLabely2.Visible = false;
            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
            {
                //目前这个只检测对称的 //若不对称更换半径角度等参数重新计算另一边x
                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;
        }
        private void mBtn计算断面面积_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(mTextBoxEdit蜗室平均速度.Text) || mTextBoxEdit蜗室平均速度.Text == "请输入蜗室平均速度")
            double v3 = 0;
            if (string.IsNullOrEmpty(textBoxV3.Text) || !double.TryParse(textBoxV3.Text, out v3) || v3 <= 0.1)
            {
                skyLabel蜗室平均速度.Visible = true;
                MessageBox.Show("请先输入蜗室平均速度!");
                return;
            }
            if (_paras == null)
            if (_sectionBundleInfo == null)
            {
                _paras = new ViewModel.SectionBundleInfo();
                _sectionBundleInfo = new ViewModel.SectionBundleInfo();
            }
            double v3 = Convert.ToDouble(mTextBoxEdit蜗室平均速度.Text);
            _paras.V3 = v3;
            _paras.CalcParaV3(this._hdrBaseInfo,this._geomBaseInfo, v3);
            RefrehPara();
            _sectionBundleInfo.V3 = v3;
            _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);
            }
        }
        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、y2!");
                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、y2!");
            //    return;
            //}
        }
        private void RBtn断面对称梯形_CheckedChanged(object sender)
        {
            if (RBtn断面对称梯形.Checked)
            {
                skyTextBox断面y18.Enabled = true;
                skyTextBox断面r18.Enabled = false;
                RefrehSectBundlePara();
                RefreshShape(_sectionBundleInfo);
                //skyTextBox断面y18.Enabled = true;
                //skyTextBox断面r18.Enabled = false;
            }
        }
@@ -355,20 +599,175 @@
        {
            if (RBtn不对称梯形.Checked)
            {
                skyTextBox断面y18.Enabled = true;
                skyTextBox断面r18.Enabled = true;
                RefrehSectBundlePara();
                RefreshShape(_sectionBundleInfo);
                //skyTextBox断面y18.Enabled = true;
                //skyTextBox断面r18.Enabled = true;
            }
        }
        public Action<ViewModel.SectionBundleInfo> OnRefreshShape = null;
        private void materialButton1_Click(object sender, EventArgs e)
        private void textBoxK3_TextChanged(object sender, EventArgs e)
        {
            double K3 = 0;
            if (string.IsNullOrEmpty(textBoxK3.Text))
                return;
            if (!double.TryParse(textBoxK3.Text, out K3))
                return;
            if (K3 < 0.1)
                return;
            var g = 9.81;
            this.textBoxV3.Text = Math.Round(K3 * Math.Sqrt(2 * g * _hdrBaseInfo.Q), 2).ToString();
        }
        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;
            RefreshShape(paras);
        }
        private void RefreshShape(ViewModel.SectionBundleInfo paras)
        {
            if (OnRefreshShape == null)
                return;
            //paras.InitialAllParameters(this._hdrBaseInfo,this._geomBaseInfo);
            OnRefreshShape.Invoke(paras);
            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);
            }
        }
    }
}