From b4c867bf85d3edef5d084a3a26f13cbc6784bf58 Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期一, 16 十二月 2024 13:37:21 +0800 Subject: [PATCH] 提交 --- WinFrmUI/DPumpHydr.WinFrmUI.Volute/出水设计/ctrlSetOutflowStyle.cs | 187 ++++++++++++---------------------------------- 1 files changed, 50 insertions(+), 137 deletions(-) diff --git "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/ctrlSetOutflowStyle.cs" "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/ctrlSetOutflowStyle.cs" index 4774bd4..43eefba 100644 --- "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/ctrlSetOutflowStyle.cs" +++ "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/ctrlSetOutflowStyle.cs" @@ -1,4 +1,6 @@ -锘� +锘� + +using DPumpHydr.WinFrmUI.Volute.ViewModel; using System; using System.Collections.Generic; using System.ComponentModel; @@ -17,162 +19,73 @@ public ctrlSetOutflowStyle() { InitializeComponent(); + AddControlToPanel(_type, panel); BuildAllTips(); - BuildIcon(); } - - private void BuildIcon() + int _type = 0; + public void SetBindingData(eOutflowStyle eOutflowStyle) { - //鎵╂暎绠″舰鐘跺浘鐗� - metroTile鎵╂暎绠″舰鐘�.BackgroundImage = GlobalResource.BuildImage("kuosanguan.png", 878, 238); - - //杈撳叆妗嗗墠缂�鍥剧墖 - mlTextBoxEdit鎵╂暎绠¢暱搴�.LeadingIcon = GlobalResource.GetLeadingIcon(); - mlTextBoxEdit涓績璺濈.LeadingIcon = GlobalResource.GetLeadingIcon(); + if (eOutflowStyle == eOutflowStyle.涓績鍑哄彛_鍨傜洿娉曞叞闈㈡祦鍑�) + { + _type = 0; + panel.Controls.Clear(); + AddControlToPanel(_type, panel); + } + if (eOutflowStyle == eOutflowStyle.渚ч潰鍑哄彛_鏇茬嚎杩炴帴) + { + _type = 1; + panel.Controls.Clear(); + AddControlToPanel(_type, panel); + } + if (eOutflowStyle == eOutflowStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴) + { + _type = 2; + panel.Controls.Clear(); + AddControlToPanel(_type, panel); + } } - - public bool Verify(out string error) + private Control AddControlToPanel(int type, Panel panel) { - error = ""; - bool isOk = true; - if (string.IsNullOrEmpty(mlTextBoxEdit鎵╂暎绠¢暱搴�.Text) || mlTextBoxEdit鎵╂暎绠¢暱搴�.Text == "璇疯緭鍏ユ墿鏁g闀垮害" || double.Parse(mlTextBoxEdit鎵╂暎绠¢暱搴�.Text) == 0) + Control newControl = null; + switch (type) { - error = "璇疯緭鍏ユ墿鏁g闀垮害锛�"; - isOk = false; - mlTextBoxEdit鎵╂暎绠¢暱搴�.TrailingIcon = GlobalResource.GetTipTrailingIcon(); - skyLabel鎵╂暎绠¢暱搴�.Visible = true; + case 0: + newControl = new centralExitControl(); + metroTile鎵╂暎绠″舰鐘�.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238); + break; + case 1: + newControl = new sideCurveExitControl(); + metroTile鎵╂暎绠″舰鐘�.BackgroundImage = GlobalResource.BuildImage("Side-exit-curve.png", 878, 238); + break; + case 2: + newControl = new sidelineExitControl(); + metroTile鎵╂暎绠″舰鐘�.BackgroundImage = GlobalResource.BuildImage("Side-exit-straight-line.png", 878, 238); + break; + default: + throw new ArgumentException("Invalid control type"); } - if (string.IsNullOrEmpty(mlTextBoxEdit涓績璺濈.Text) || mlTextBoxEdit涓績璺濈.Text == "璇疯緭鍏ヤ腑蹇冭窛绂�" || double.Parse(mlTextBoxEdit涓績璺濈.Text) == 0) - { - error = "璇疯緭鍏ヤ腑蹇冭窛绂伙紒"; - isOk = false; - mlTextBoxEdit涓績璺濈.TrailingIcon = GlobalResource.GetTipTrailingIcon(); - skyLabel涓績璺濈.Visible = true; - } - return isOk; + + // 灏嗘帶浠舵坊鍔犲埌Panel涓� + panel.Controls.Add(newControl); + newControl.Dock = DockStyle.Top; + return newControl; } + + + private void BuildAllTips() { metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.metroTile鎵╂暎绠″舰鐘�, "鏂潰鍥�"); - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.mlTextBoxEdit鎵╂暎绠¢暱搴�, "铚楀涓恫浣撴祦鍔╘n璺緞鐨勬墿灞曟垨鎵‐n鏁g▼搴�"); - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.mlTextBoxEdit涓績璺濈, "涓績璺濈 瑙i噴"); - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.crownLabel鍑哄彛, "鍑哄彛 瑙i噴"); - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.dungeonNumeric鍑哄彛, "鍑哄彛 瑙i噴"); - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.metroTrackBar鍑哄彛, "鍑哄彛 瑙i噴"); - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.crownLabel绗叓绔潰, "绗叓鏂潰 瑙i噴"); - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.dungeonNumeric绗叓绔潰, "绗叓绔潰 瑙i噴"); - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.metroTrackBar绗叓绔潰, "绗叓绔潰 瑙i噴"); } - private void metroTrackBar绗叓绔潰_Scroll(object sender) - { - dungeonNumeric绗叓绔潰.Value = metroTrackBar绗叓绔潰.Value; - } - private void metroTrackBar鍑哄彛_Scroll(object sender) - { - dungeonNumeric鍑哄彛.Value = metroTrackBar鍑哄彛.Value; - } - private void dungeonNumeric鍑哄彛_Leave(object sender, EventArgs e) - { - metroTrackBar鍑哄彛.Value = (int)(dungeonNumeric鍑哄彛.Value); - } - private void dungeonNumeric绗叓绔潰_Leave(object sender, EventArgs e) - { - metroTrackBar绗叓绔潰.Value = (int)(dungeonNumeric绗叓绔潰.Value); - } - - private void mlTextBoxEdit鎵╂暎闀垮害_TextChanged(object sender, EventArgs e) - { - foreach (var s in mlTextBoxEdit鎵╂暎绠¢暱搴�.Text) - { - if (!double.TryParse(mlTextBoxEdit鎵╂暎绠¢暱搴�.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEdit鎵╂暎绠¢暱搴�.Text) && mlTextBoxEdit鎵╂暎绠¢暱搴�.Text != "璇疯緭鍏ユ墿鏁g闀垮害") - { - mlTextBoxEdit鎵╂暎绠¢暱搴�.UseAccent = true; - mlTextBoxEdit鎵╂暎绠¢暱搴�.ShowAssistiveText = true; - mlTextBoxEdit鎵╂暎绠¢暱搴�.Text = ""; - break; - } - else - { - mlTextBoxEdit鎵╂暎绠¢暱搴�.ShowAssistiveText = false; - mlTextBoxEdit鎵╂暎绠¢暱搴�.UseAccent = false; - } - } - } - - private void mlTextBoxEdit鎵╂暎闀垮害_Enter(object sender, EventArgs e) - { - skyLabel鎵╂暎绠¢暱搴�.Visible = false; - mlTextBoxEdit鎵╂暎绠¢暱搴�.TrailingIcon = null; - if (mlTextBoxEdit鎵╂暎绠¢暱搴�.Text == "璇疯緭鍏ユ墿鏁g闀垮害") - { - mlTextBoxEdit鎵╂暎绠¢暱搴�.Text = ""; - } - } - - private void mlTextBoxEdit鎵╂暎闀垮害_Leave(object sender, EventArgs e) - { - if (string.IsNullOrEmpty(mlTextBoxEdit鎵╂暎绠¢暱搴�.Text) || double.Parse(mlTextBoxEdit鎵╂暎绠¢暱搴�.Text) == 0) - { - mlTextBoxEdit鎵╂暎绠¢暱搴�.Text = "璇疯緭鍏ユ墿鏁g闀垮害"; - } - } - - private void mlTextBoxEdit涓績璺濈_Enter(object sender, EventArgs e) - { - skyLabel涓績璺濈.Visible = false; - mlTextBoxEdit涓績璺濈.TrailingIcon = null; - if (mlTextBoxEdit涓績璺濈.Text == "璇疯緭鍏ヤ腑蹇冭窛绂�") - { - mlTextBoxEdit涓績璺濈.Text = ""; - } - } - - private void mlTextBoxEdit涓績璺濈_Leave(object sender, EventArgs e) - { - if (string.IsNullOrEmpty(mlTextBoxEdit涓績璺濈.Text) || double.Parse(mlTextBoxEdit涓績璺濈.Text) == 0) - { - mlTextBoxEdit涓績璺濈.Text = "璇疯緭鍏ヤ腑蹇冭窛绂�"; - } - } - - private void mlTextBoxEdit涓績璺濈_TextChanged(object sender, EventArgs e) - { - foreach (var s in mlTextBoxEdit涓績璺濈.Text) - { - if (!double.TryParse(mlTextBoxEdit涓績璺濈.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEdit涓績璺濈.Text) && mlTextBoxEdit涓績璺濈.Text != "璇疯緭鍏ヤ腑蹇冭窛绂�") - { - mlTextBoxEdit涓績璺濈.UseAccent = true; - mlTextBoxEdit涓績璺濈.ShowAssistiveText = true; - mlTextBoxEdit涓績璺濈.Text = ""; - break; - } - else - { - mlTextBoxEdit涓績璺濈.ShowAssistiveText = false; - mlTextBoxEdit涓績璺濈.UseAccent = false; - } - } - } private void mBtn鏇存柊妯″瀷_Click(object sender, EventArgs e) { - if (mlTextBoxEdit鎵╂暎绠¢暱搴�.Text == "璇疯緭鍏ユ墿鏁g闀垮害" || string.IsNullOrEmpty(mlTextBoxEdit鎵╂暎绠¢暱搴�.Text)) - { - skyLabel鎵╂暎绠¢暱搴�.Visible = true; - MessageBox.Show("璇峰厛杈撳叆鎵╂暎绠¢暱搴︼紒"); - return; - } - if (mlTextBoxEdit涓績璺濈.Text == "璇疯緭鍏ヤ腑蹇冭窛绂�" || string.IsNullOrEmpty(mlTextBoxEdit涓績璺濈.Text)) - { - skyLabel涓績璺濈.Visible = true; - MessageBox.Show("璇峰厛杈撳叆涓績璺濈锛�"); - return; - } + } } } -- Gitblit v1.9.3