using DPumpHydr.WinFrmUI.RLT.Controls; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace DPumpHydr.WinFrmUI.Volute { public partial class centralExitControl : UserControl { public centralExitControl() { InitializeComponent(); BuildAllTips(); BuildIcon(); } private void BuildIcon() { //输入框前缀图片 mlTextBoxEditR1.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEditR2.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEdith1.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEdith2.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEditL.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEditr.LeadingIcon = GlobalResource.GetLeadingIcon(); mlTextBoxEdit扩散管出口直径.LeadingIcon = GlobalResource.GetLeadingIcon(); } public bool Verify(out string error) { error = ""; bool isOk = true; if (string.IsNullOrEmpty(mlTextBoxEditR1.Text) || mlTextBoxEditR1.Text == "请输入" || double.Parse(mlTextBoxEditR1.Text) == 0) { error = "请输入R1!"; isOk = false; mlTextBoxEditR1.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabelR1.Visible = true; } if (string.IsNullOrEmpty(mlTextBoxEditR2.Text) || mlTextBoxEditR2.Text == "请输入" || double.Parse(mlTextBoxEditR2.Text) == 0) { error = "请输入R2!"; isOk = false; mlTextBoxEditR2.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabelR2.Visible = true; } if (string.IsNullOrEmpty(mlTextBoxEdit扩散管出口直径.Text) || mlTextBoxEdit扩散管出口直径.Text == "请输入扩散管出口直径" || double.Parse(mlTextBoxEdit扩散管出口直径.Text) == 0) { error = "请输入扩散管出口直径!"; isOk = false; mlTextBoxEdit扩散管出口直径.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabel扩散管出口直径.Visible = true; } if (string.IsNullOrEmpty(mlTextBoxEdith1.Text) || mlTextBoxEdith1.Text == "请输入" || double.Parse(mlTextBoxEdith1.Text) == 0) { error = "请输入h1!"; isOk = false; mlTextBoxEdith1.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabelh1.Visible = true; } if (string.IsNullOrEmpty(mlTextBoxEdith2.Text) || mlTextBoxEdith2.Text == "请输入" || double.Parse(mlTextBoxEdith2.Text) == 0) { error = "请输入h2!"; isOk = false; mlTextBoxEdith2.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabelh2.Visible = true; } if (string.IsNullOrEmpty(mlTextBoxEditL.Text) || mlTextBoxEditL.Text == "请输入" || double.Parse(mlTextBoxEditL.Text) == 0) { error = "请输入L!"; isOk = false; mlTextBoxEditL.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabelL.Visible = true; } if (string.IsNullOrEmpty(mlTextBoxEditr.Text) || mlTextBoxEditr.Text == "请输入" || double.Parse(mlTextBoxEditr.Text) == 0) { error = "请输入r!"; isOk = false; mlTextBoxEditr.TrailingIcon = GlobalResource.GetTipTrailingIcon(); skyLabelr.Visible = true; } return isOk; } private void BuildAllTips() { metroToolTip中心出口.SetToolTip(this.mlTextBoxEditR1, "R1"); metroToolTip中心出口.SetToolTip(this.mlTextBoxEditR2, "R2"); metroToolTip中心出口.SetToolTip(this.mlTextBoxEdith1, "h1"); metroToolTip中心出口.SetToolTip(this.mlTextBoxEdith2, "h2"); metroToolTip中心出口.SetToolTip(this.mlTextBoxEditL, "L"); metroToolTip中心出口.SetToolTip(this.mlTextBoxEditr, "r"); metroToolTip中心出口.SetToolTip(this.mlTextBoxEdit扩散管出口直径, "扩散管出口直径"); } private void mlTextBoxEditR1_Enter(object sender, EventArgs e) { skyLabelR1.Visible = false; mlTextBoxEditR1.TrailingIcon = null; if (mlTextBoxEditR1.Text == "请输入") { mlTextBoxEditR1.Text = ""; } } private void mlTextBoxEditR1_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(mlTextBoxEditR1.Text) || double.Parse(mlTextBoxEditR1.Text) == 0) { mlTextBoxEditR1.Text = "请输入"; } } private void mlTextBoxEditR1_TextChanged(object sender, EventArgs e) { foreach (var s in mlTextBoxEditR1.Text) { if (!double.TryParse(mlTextBoxEditR1.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditR1.Text) && mlTextBoxEditR1.Text != "请输入") { mlTextBoxEditR1.UseAccent = true; mlTextBoxEditR1.ShowAssistiveText = true; mlTextBoxEditR1.Text = ""; break; } else { mlTextBoxEditR1.ShowAssistiveText = false; mlTextBoxEditR1.UseAccent = false; } } } private void mlTextBoxEditR2_Enter(object sender, EventArgs e) { skyLabelR2.Visible = false; mlTextBoxEditR2.TrailingIcon = null; if (mlTextBoxEditR2.Text == "请输入") { mlTextBoxEditR2.Text = ""; } } private void mlTextBoxEditR2_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(mlTextBoxEditR2.Text) || double.Parse(mlTextBoxEditR2.Text) == 0) { mlTextBoxEditR2.Text = "请输入"; } } private void mlTextBoxEditR2_TextChanged(object sender, EventArgs e) { foreach (var s in mlTextBoxEditR2.Text) { if (!double.TryParse(mlTextBoxEditR2.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditR2.Text) && mlTextBoxEditR2.Text != "请输入") { mlTextBoxEditR2.UseAccent = true; mlTextBoxEditR2.ShowAssistiveText = true; mlTextBoxEditR2.Text = ""; break; } else { mlTextBoxEditR2.ShowAssistiveText = false; mlTextBoxEditR2.UseAccent = false; } } } private void mlTextBoxEdith1_Enter(object sender, EventArgs e) { skyLabelh1.Visible = false; mlTextBoxEdith1.TrailingIcon = null; if (mlTextBoxEdith1.Text == "请输入") { mlTextBoxEdith1.Text = ""; } } private void mlTextBoxEdith1_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(mlTextBoxEdith1.Text) || double.Parse(mlTextBoxEdith1.Text) == 0) { mlTextBoxEdith1.Text = "请输入"; } } private void mlTextBoxEdith1_TextChanged(object sender, EventArgs e) { foreach (var s in mlTextBoxEdith1.Text) { if (!double.TryParse(mlTextBoxEdith1.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEdith1.Text) && mlTextBoxEdith1.Text != "请输入") { mlTextBoxEdith1.UseAccent = true; mlTextBoxEdith1.ShowAssistiveText = true; mlTextBoxEdith1.Text = ""; break; } else { mlTextBoxEdith1.ShowAssistiveText = false; mlTextBoxEdith1.UseAccent = false; } } } private void mlTextBoxEdith2_Enter(object sender, EventArgs e) { skyLabelh2.Visible = false; mlTextBoxEdith2.TrailingIcon = null; if (mlTextBoxEdith2.Text == "请输入") { mlTextBoxEdith2.Text = ""; } } private void mlTextBoxEdith2_TextChanged(object sender, EventArgs e) { foreach (var s in mlTextBoxEdith2.Text) { if (!double.TryParse(mlTextBoxEdith2.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEdith2.Text) && mlTextBoxEdith2.Text != "请输入") { mlTextBoxEdith2.UseAccent = true; mlTextBoxEdith2.ShowAssistiveText = true; mlTextBoxEdith2.Text = ""; break; } else { mlTextBoxEdith2.ShowAssistiveText = false; mlTextBoxEdith2.UseAccent = false; } } } private void mlTextBoxEditL_Enter(object sender, EventArgs e) { skyLabelL.Visible = false; mlTextBoxEditL.TrailingIcon = null; if (mlTextBoxEditL.Text == "请输入") { mlTextBoxEditL.Text = ""; } } private void mlTextBoxEditL_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(mlTextBoxEditL.Text) || double.Parse(mlTextBoxEditL.Text) == 0) { mlTextBoxEditL.Text = "请输入"; } } private void mlTextBoxEditL_TextChanged(object sender, EventArgs e) { foreach (var s in mlTextBoxEditL.Text) { if (!double.TryParse(mlTextBoxEditL.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditL.Text) && mlTextBoxEditL.Text != "请输入") { mlTextBoxEditL.UseAccent = true; mlTextBoxEditL.ShowAssistiveText = true; mlTextBoxEditL.Text = ""; break; } else { mlTextBoxEditL.ShowAssistiveText = false; mlTextBoxEditL.UseAccent = false; } } } private void mlTextBoxEditr_Enter(object sender, EventArgs e) { skyLabelr.Visible = false; mlTextBoxEditr.TrailingIcon = null; if (mlTextBoxEditr.Text == "请输入") { mlTextBoxEditr.Text = ""; } } private void mlTextBoxEditr_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(mlTextBoxEditr.Text) || double.Parse(mlTextBoxEditr.Text) == 0) { mlTextBoxEditr.Text = "请输入"; } } private void mlTextBoxEditr_TextChanged(object sender, EventArgs e) { foreach (var s in mlTextBoxEditr.Text) { if (!double.TryParse(mlTextBoxEditr.Text, out double result) && !string.IsNullOrEmpty(mlTextBoxEditr.Text) && mlTextBoxEditr.Text != "请输入") { mlTextBoxEditr.UseAccent = true; mlTextBoxEditr.ShowAssistiveText = true; mlTextBoxEditr.Text = ""; break; } else { mlTextBoxEditr.ShowAssistiveText = false; mlTextBoxEditr.UseAccent = false; } } } 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 mlTextBoxEdith2_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(mlTextBoxEdith2.Text) || double.Parse(mlTextBoxEdith2.Text) == 0) { mlTextBoxEdith2.Text = "请输入"; } } } }