yangyin
2024-10-22 90573e299e2eea301a0ad8585a7e6b95d7a798bb
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
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();
            Tips();
            addimage();
        }
 
        /// <summary>
        /// 图片
        /// </summary>
        /// <param name="path">文件夹路径(编译路径下的)</param>
        /// <param name="filename">文件名</param>
        /// <returns></returns>
        private System.Drawing.Image Icon(string path, string filename)
        {
            System.Drawing.Image thumbnail = AssembledPath(path, filename).GetThumbnailImage(878, 538, () => false, IntPtr.Zero);
            return thumbnail;
        }
 
        /// <summary>
        /// 路径、文件名拼接
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="filename">文件名</param>
        /// <returns></returns>
        private System.Drawing.Image AssembledPath(string path, string filename)
        {
            if (path == null && filename == null)
            {
                return null;
            }
            string fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path, filename);
            System.Drawing.Image image = System.Drawing.Image.FromFile(fullPath);
            return image;
        }
 
        private void addimage()
        {
            string ResourcesPath = @"Data\MainForm\Icons";
            metroTile扩散管形状.BackgroundImage = Icon(ResourcesPath, "kuosanguan.png");
        }
 
        private void Tips()
        {
            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)
        {
            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)
        {
            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;
                }
            }
        }
    }
}