yangyin
2024-10-22 4568aa9c4b13991b2d32b1560afdb5cacbc0e8f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
using DPumpHydr.WinFrmUI.RLT.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace DPumpHydr.WinFrmUI.Volute 
{
    public partial class ctrlSetOutflowStyle : UserControl
    {
        public ctrlSetOutflowStyle()
        {
            InitializeComponent();
            BuildAllTips();
            BuildIcon();
        }
 
        private void BuildIcon()
        {
            //扩散管形状图片
            metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("kuosanguan.png", 878, 238);
 
            //输入框前缀图片
            mlTextBoxEdit扩散管长度.LeadingIcon = GlobalResource.GetLeadingIcon();
            mlTextBoxEdit中心距离.LeadingIcon = GlobalResource.GetLeadingIcon();
        }
 
        public bool Verify(out string error)
        {
            error = "";
            bool isOk = true;
            if (string.IsNullOrEmpty(mlTextBoxEdit扩散管长度.Text) || mlTextBoxEdit扩散管长度.Text == "请输入扩散管长度")
            {
                error = "请输入扩散管长度!";
                isOk = false;
                mlTextBoxEdit扩散管长度.TrailingIcon = GlobalResource.GetTipTrailingIcon();
                skyLabel扩散管长度.Visible = true;
            }
            if (string.IsNullOrEmpty(mlTextBoxEdit中心距离.Text) || mlTextBoxEdit中心距离.Text == "请输入中心距离")
            {
                error = "请输入中心距离!";
                isOk = false;
                mlTextBoxEdit中心距离.TrailingIcon = GlobalResource.GetTipTrailingIcon();
                skyLabel中心距离.Visible = true;
            }
            return isOk;
        }
 
        private void BuildAllTips()
        {
            metroToolTip第六步提示.SetToolTip(this.metroTile扩散管形状, "断面图");
            metroToolTip第六步提示.SetToolTip(this.mlTextBoxEdit扩散管长度, "蜗室中液体流动\n路径的扩展或扩\n散程度");
            metroToolTip第六步提示.SetToolTip(this.mlTextBoxEdit中心距离, "中心距离 解释");
            metroToolTip第六步提示.SetToolTip(this.crownLabel出口, "出口 解释");
            metroToolTip第六步提示.SetToolTip(this.dungeonNumeric出口, "出口 解释");
            metroToolTip第六步提示.SetToolTip(this.metroTrackBar出口, "出口 解释");
            metroToolTip第六步提示.SetToolTip(this.crownLabel第八端面, "第八断面 解释");
            metroToolTip第六步提示.SetToolTip(this.dungeonNumeric第八端面, "第八端面 解释");
            metroToolTip第六步提示.SetToolTip(this.metroTrackBar第八端面, "第八端面 解释");
        }
 
        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 != "请输入扩散管长度")
                {
                    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 == "请输入扩散管长度")
            {
                mlTextBoxEdit扩散管长度.Text = "";
            }
        }
 
        private void mlTextBoxEdit扩散长度_Leave(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(mlTextBoxEdit扩散管长度.Text))
            {
                mlTextBoxEdit扩散管长度.Text = "请输入扩散管长度";
            }
        }
 
        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))
            {
                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 == "请输入扩散管长度" || string.IsNullOrEmpty(mlTextBoxEdit扩散管长度.Text))
            {
                skyLabel扩散管长度.Visible = true;
                MessageBox.Show("请先输入扩散管长度!");
                return;
            }
            if (mlTextBoxEdit中心距离.Text == "请输入中心距离" || string.IsNullOrEmpty(mlTextBoxEdit中心距离.Text))
            {
                skyLabel中心距离.Visible = true;
                MessageBox.Show("请先输入中心距离!");
                return;
            }
        }
    }
}