MethodSettingDialog.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Model;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace Metis.DedicatedAnalysis.Inclusions.New_DIN50602_1985
  12. {
  13. public partial class MethodSettingDialog : Form
  14. {
  15. private Button button2;
  16. private Button button1;
  17. private GroupBox groupBox2;
  18. private Label label4;
  19. private Label label3;
  20. private Label label2;
  21. private Label label1;
  22. private NumericUpDown numericUpDown1;
  23. private NumericUpDown numericUpDown2;
  24. private NumericUpDown numericUpDown3;
  25. private NumericUpDown numericUpDown4;
  26. private GroupBox groupBox1;
  27. // 创建委托
  28. public delegate void TransferDataDelegate(InclusionSetting inclusionSetting);
  29. // 声明一个事件(本质是一个委托)
  30. public event TransferDataDelegate TransferEvent;
  31. private InclusionSetting inclusionSetting;
  32. public MethodSettingDialog(InclusionSetting inclusionSetting)
  33. {
  34. this.inclusionSetting = inclusionSetting;
  35. InitializeComponent();
  36. numericUpDown1.Value = Convert.ToInt32(this.inclusionSetting.minLength);
  37. numericUpDown2.Value = Convert.ToInt32(this.inclusionSetting.minWidth);
  38. numericUpDown3.Value = Convert.ToDecimal(this.inclusionSetting.aspectRatio);
  39. numericUpDown4.Value = Convert.ToInt32(this.inclusionSetting.kNum);
  40. }
  41. private void InitializeComponent()
  42. {
  43. this.groupBox1 = new System.Windows.Forms.GroupBox();
  44. this.button2 = new System.Windows.Forms.Button();
  45. this.button1 = new System.Windows.Forms.Button();
  46. this.groupBox2 = new System.Windows.Forms.GroupBox();
  47. this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
  48. this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
  49. this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
  50. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  51. this.label4 = new System.Windows.Forms.Label();
  52. this.label3 = new System.Windows.Forms.Label();
  53. this.label2 = new System.Windows.Forms.Label();
  54. this.label1 = new System.Windows.Forms.Label();
  55. this.groupBox1.SuspendLayout();
  56. this.groupBox2.SuspendLayout();
  57. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
  58. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
  59. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
  60. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  61. this.SuspendLayout();
  62. //
  63. // groupBox1
  64. //
  65. this.groupBox1.Controls.Add(this.button2);
  66. this.groupBox1.Controls.Add(this.button1);
  67. this.groupBox1.Location = new System.Drawing.Point(7, 12);
  68. this.groupBox1.Name = "groupBox1";
  69. this.groupBox1.Size = new System.Drawing.Size(390, 50);
  70. this.groupBox1.TabIndex = 0;
  71. this.groupBox1.TabStop = false;
  72. this.groupBox1.Text = "操作";
  73. //
  74. // button2
  75. //
  76. this.button2.Location = new System.Drawing.Point(309, 14);
  77. this.button2.Name = "button2";
  78. this.button2.Size = new System.Drawing.Size(75, 23);
  79. this.button2.TabIndex = 1;
  80. this.button2.Text = "取消";
  81. this.button2.UseVisualStyleBackColor = true;
  82. this.button2.Click += new System.EventHandler(this.button2_Click);
  83. //
  84. // button1
  85. //
  86. this.button1.Location = new System.Drawing.Point(228, 14);
  87. this.button1.Name = "button1";
  88. this.button1.Size = new System.Drawing.Size(75, 23);
  89. this.button1.TabIndex = 0;
  90. this.button1.Text = "确定";
  91. this.button1.UseVisualStyleBackColor = true;
  92. this.button1.Click += new System.EventHandler(this.button1_Click);
  93. //
  94. // groupBox2
  95. //
  96. this.groupBox2.Controls.Add(this.numericUpDown4);
  97. this.groupBox2.Controls.Add(this.numericUpDown3);
  98. this.groupBox2.Controls.Add(this.numericUpDown2);
  99. this.groupBox2.Controls.Add(this.numericUpDown1);
  100. this.groupBox2.Controls.Add(this.label4);
  101. this.groupBox2.Controls.Add(this.label3);
  102. this.groupBox2.Controls.Add(this.label2);
  103. this.groupBox2.Controls.Add(this.label1);
  104. this.groupBox2.Location = new System.Drawing.Point(7, 68);
  105. this.groupBox2.Name = "groupBox2";
  106. this.groupBox2.Size = new System.Drawing.Size(390, 149);
  107. this.groupBox2.TabIndex = 1;
  108. this.groupBox2.TabStop = false;
  109. this.groupBox2.Text = "参数设置";
  110. //
  111. // numericUpDown4
  112. //
  113. this.numericUpDown4.Location = new System.Drawing.Point(274, 88);
  114. this.numericUpDown4.Name = "numericUpDown4";
  115. this.numericUpDown4.Size = new System.Drawing.Size(90, 21);
  116. this.numericUpDown4.TabIndex = 7;
  117. //
  118. // numericUpDown3
  119. //
  120. this.numericUpDown3.DecimalPlaces = 1;
  121. this.numericUpDown3.Increment = new decimal(new int[] {
  122. 1,
  123. 0,
  124. 0,
  125. 65536});
  126. this.numericUpDown3.Location = new System.Drawing.Point(97, 88);
  127. this.numericUpDown3.Name = "numericUpDown3";
  128. this.numericUpDown3.Size = new System.Drawing.Size(90, 21);
  129. this.numericUpDown3.TabIndex = 6;
  130. //
  131. // numericUpDown2
  132. //
  133. this.numericUpDown2.Location = new System.Drawing.Point(274, 28);
  134. this.numericUpDown2.Name = "numericUpDown2";
  135. this.numericUpDown2.Size = new System.Drawing.Size(90, 21);
  136. this.numericUpDown2.TabIndex = 5;
  137. //
  138. // numericUpDown1
  139. //
  140. this.numericUpDown1.Location = new System.Drawing.Point(97, 28);
  141. this.numericUpDown1.Name = "numericUpDown1";
  142. this.numericUpDown1.Size = new System.Drawing.Size(90, 21);
  143. this.numericUpDown1.TabIndex = 4;
  144. //
  145. // label4
  146. //
  147. this.label4.AutoSize = true;
  148. this.label4.Location = new System.Drawing.Point(245, 90);
  149. this.label4.Name = "label4";
  150. this.label4.Size = new System.Drawing.Size(23, 12);
  151. this.label4.TabIndex = 3;
  152. this.label4.Text = "K:";
  153. //
  154. // label3
  155. //
  156. this.label3.AutoSize = true;
  157. this.label3.Location = new System.Drawing.Point(206, 30);
  158. this.label3.Name = "label3";
  159. this.label3.Size = new System.Drawing.Size(65, 12);
  160. this.label3.TabIndex = 2;
  161. this.label3.Text = "最小宽度:";
  162. //
  163. // label2
  164. //
  165. this.label2.AutoSize = true;
  166. this.label2.Location = new System.Drawing.Point(26, 90);
  167. this.label2.Name = "label2";
  168. this.label2.Size = new System.Drawing.Size(53, 12);
  169. this.label2.TabIndex = 1;
  170. this.label2.Text = "长度比:";
  171. //
  172. // label1
  173. //
  174. this.label1.AutoSize = true;
  175. this.label1.Location = new System.Drawing.Point(26, 30);
  176. this.label1.Name = "label1";
  177. this.label1.Size = new System.Drawing.Size(65, 12);
  178. this.label1.TabIndex = 0;
  179. this.label1.Text = "最小长度:";
  180. //
  181. // MethodSettingDialog
  182. //
  183. this.ClientSize = new System.Drawing.Size(405, 225);
  184. this.Controls.Add(this.groupBox2);
  185. this.Controls.Add(this.groupBox1);
  186. this.Name = "MethodSettingDialog";
  187. this.Text = "参数设置";
  188. this.groupBox1.ResumeLayout(false);
  189. this.groupBox2.ResumeLayout(false);
  190. this.groupBox2.PerformLayout();
  191. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
  192. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
  193. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
  194. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  195. this.ResumeLayout(false);
  196. }
  197. /// <summary>
  198. /// 确定
  199. /// </summary>
  200. /// <param name="sender"></param>
  201. /// <param name="e"></param>
  202. private void button1_Click(object sender, EventArgs e)
  203. {
  204. this.inclusionSetting.minLength = Convert.ToDouble(numericUpDown1.Value);
  205. this.inclusionSetting.minWidth = Convert.ToDouble(numericUpDown2.Value);
  206. this.inclusionSetting.aspectRatio = Convert.ToDouble(numericUpDown3.Value);
  207. this.inclusionSetting.kNum = Convert.ToInt32(numericUpDown4.Value);
  208. TransferEvent(this.inclusionSetting);
  209. this.Close();
  210. }
  211. /// <summary>
  212. /// 取消
  213. /// </summary>
  214. /// <param name="sender"></param>
  215. /// <param name="e"></param>
  216. private void button2_Click(object sender, EventArgs e)
  217. {
  218. this.Close();
  219. }
  220. }
  221. }