PorosityViewSetting.cs 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. using Metis.DedicatedAnalysis.Porosity.Model;
  2. using PaintDotNet;
  3. using PaintDotNet.Annotation;
  4. using PaintDotNet.Annotation.Enum;
  5. using PaintDotNet.Base.CommTool;
  6. using PaintDotNet.Base.DedicatedAnalysis.Porosity;
  7. using PaintDotNet.DedicatedAnalysis.Porosity;
  8. using PaintDotNet.DedicatedAnalysis.Porosity.PV6093;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.IO;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Threading.Tasks;
  18. using System.Windows.Forms;
  19. namespace Metis.DedicatedAnalysis.Porosity
  20. {
  21. internal class PorosityViewSetting : PdnBaseForm
  22. {
  23. private GroupBox groupBox_operating;
  24. private Button button2;
  25. private Button button1;
  26. private GroupBox groupBox_img;
  27. protected ListBox lstView_img;
  28. private GroupBox groupBox1;
  29. private Label label_showBinaryColor;
  30. private Panel panel_showBinaryColor;
  31. private GroupBox groupBox6;
  32. private NumericUpDown numericUpDown4;
  33. private NumericUpDown numericUpDown3;
  34. private Label label5;
  35. private Label label6;
  36. private GroupBox groupBox4;
  37. private NumericUpDown numericUpDown6;
  38. private NumericUpDown numericUpDown5;
  39. private RadioButton radioButton2;
  40. private RadioButton radioButton1;
  41. private Label label4;
  42. private Label label3;
  43. private GroupBox groupBox3;
  44. private Panel panel5;
  45. private Panel panel6;
  46. private Panel panel4;
  47. private Panel panel3;
  48. private Panel panel2;
  49. private Panel panel1;
  50. private Panel panel9;
  51. private Panel panel8;
  52. private Panel panel7;
  53. private Panel panel11;
  54. private Panel panel10;
  55. private Panel panel12;
  56. private Button btn_saveresult;
  57. private viewSetting ViewSetting;
  58. private int chooseIndex;
  59. private List<DrawObject> drawObjectList;
  60. private List<string> nameList;
  61. private ColorsForm lineColorsFormGrid;
  62. private ColorsForm viewColorsFormGrid;
  63. private int cilckNum;
  64. private PorosityStandardDialog pform;
  65. private double pxPerUnit;
  66. /// <summary>
  67. /// 旧中心点X坐标值
  68. /// </summary>
  69. private int numericUpDown3Old;
  70. /// <summary>
  71. /// 旧中心点Y坐标值
  72. /// </summary>
  73. private int numericUpDown4Old;
  74. private Label label1;
  75. /// <summary>
  76. /// 是否是保存 1 否 2 是
  77. /// </summary>
  78. private int notSave = 1;
  79. public PorosityViewSetting(List<DrawObject> drawObjectList, List<string> nameList, int chooseIndex, viewSetting ViewSetting, PorosityStandardDialog porositysStandard, double pxPerUnit)
  80. {
  81. this.chooseIndex = chooseIndex;
  82. this.drawObjectList = drawObjectList;
  83. this.nameList = nameList;
  84. this.pxPerUnit = pxPerUnit;
  85. this.lineColorsFormGrid = new ColorsForm();
  86. this.lineColorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  87. this.viewColorsFormGrid = new ColorsForm();
  88. this.viewColorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  89. this.pform = porositysStandard;
  90. this.ViewSetting = ViewSetting;
  91. InitializeComponent();
  92. InitializeLanguageText();
  93. setData();
  94. foreach (var s in this.nameList)
  95. {
  96. this.lstView_img.Items.Add(s);
  97. }
  98. this.lstView_img.SelectedIndex = chooseIndex;
  99. //this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange);
  100. //this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange);
  101. //this.numericUpDown5.ValueChanged += new EventHandler(this.numericUpDown5_ValueChange);
  102. //this.numericUpDown6.ValueChanged += new EventHandler(this.numericUpDown6_ValueChange);
  103. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PorosityViewSettingClosing);
  104. }
  105. private void InitializeLanguageText()
  106. {
  107. this.groupBox_operating.Text = PdnResources.GetString("Menu.operation.text");
  108. this.button2.Text = PdnResources.GetString("Menu.ViewSetting.DeleteFieldOfView.Text");
  109. this.button1.Text = PdnResources.GetString("Menu.Theemptyview.Text");
  110. this.btn_saveresult.Text = PdnResources.GetString("Menu.Savethechanges.Text");
  111. this.groupBox_img.Text = PdnResources.GetString("Menu.Fieldofviewlisthasbeenadded.Text");
  112. this.groupBox1.Text = PdnResources.GetString("Menu.Theviewattribute.Text");
  113. this.groupBox6.Text = PdnResources.GetString("Menu.position.text");
  114. this.label5.Text = PdnResources.GetString("Menu.viewsetting.Modifyview.Centerpoint.text") + "Y";
  115. this.label6.Text = PdnResources.GetString("Menu.viewsetting.Modifyview.Centerpoint.text") + "X";
  116. this.groupBox4.Text = PdnResources.GetString("Menu.Edit.ActualSize.Text");
  117. this.radioButton2.Text = PdnResources.GetString("Menu.area.text");
  118. this.radioButton1.Text = PdnResources.GetString("Menu.diameter.text");
  119. this.groupBox3.Text = PdnResources.GetString("Menu.DefaultcolorSettings.Text");
  120. this.label1.Text = PdnResources.GetString("Menu.color.text");
  121. this.Text = PdnResources.GetString("Menu.ViewSetting.Text");
  122. }
  123. private void InitializeComponent()
  124. {
  125. this.groupBox_operating = new System.Windows.Forms.GroupBox();
  126. this.button2 = new System.Windows.Forms.Button();
  127. this.button1 = new System.Windows.Forms.Button();
  128. this.btn_saveresult = new System.Windows.Forms.Button();
  129. this.groupBox_img = new System.Windows.Forms.GroupBox();
  130. this.lstView_img = new System.Windows.Forms.ListBox();
  131. this.groupBox1 = new System.Windows.Forms.GroupBox();
  132. this.groupBox6 = new System.Windows.Forms.GroupBox();
  133. this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
  134. this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
  135. this.label5 = new System.Windows.Forms.Label();
  136. this.label6 = new System.Windows.Forms.Label();
  137. this.groupBox4 = new System.Windows.Forms.GroupBox();
  138. this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
  139. this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
  140. this.radioButton2 = new System.Windows.Forms.RadioButton();
  141. this.radioButton1 = new System.Windows.Forms.RadioButton();
  142. this.label4 = new System.Windows.Forms.Label();
  143. this.label3 = new System.Windows.Forms.Label();
  144. this.panel_showBinaryColor = new System.Windows.Forms.Panel();
  145. this.label_showBinaryColor = new System.Windows.Forms.Label();
  146. this.groupBox3 = new System.Windows.Forms.GroupBox();
  147. this.panel12 = new System.Windows.Forms.Panel();
  148. this.panel11 = new System.Windows.Forms.Panel();
  149. this.panel10 = new System.Windows.Forms.Panel();
  150. this.panel9 = new System.Windows.Forms.Panel();
  151. this.panel8 = new System.Windows.Forms.Panel();
  152. this.panel7 = new System.Windows.Forms.Panel();
  153. this.panel5 = new System.Windows.Forms.Panel();
  154. this.panel6 = new System.Windows.Forms.Panel();
  155. this.panel4 = new System.Windows.Forms.Panel();
  156. this.panel3 = new System.Windows.Forms.Panel();
  157. this.panel2 = new System.Windows.Forms.Panel();
  158. this.panel1 = new System.Windows.Forms.Panel();
  159. this.label1 = new System.Windows.Forms.Label();
  160. this.groupBox_operating.SuspendLayout();
  161. this.groupBox_img.SuspendLayout();
  162. this.groupBox1.SuspendLayout();
  163. this.groupBox6.SuspendLayout();
  164. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
  165. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
  166. this.groupBox4.SuspendLayout();
  167. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
  168. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
  169. this.groupBox3.SuspendLayout();
  170. this.SuspendLayout();
  171. //
  172. // groupBox_operating
  173. //
  174. this.groupBox_operating.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  175. | System.Windows.Forms.AnchorStyles.Right)));
  176. this.groupBox_operating.Controls.Add(this.button2);
  177. this.groupBox_operating.Controls.Add(this.button1);
  178. this.groupBox_operating.Controls.Add(this.btn_saveresult);
  179. this.groupBox_operating.Location = new System.Drawing.Point(12, 12);
  180. this.groupBox_operating.Name = "groupBox_operating";
  181. this.groupBox_operating.Size = new System.Drawing.Size(579, 53);
  182. this.groupBox_operating.TabIndex = 13;
  183. this.groupBox_operating.TabStop = false;
  184. //
  185. // button2
  186. //
  187. this.button2.Location = new System.Drawing.Point(383, 15);
  188. this.button2.Name = "button2";
  189. this.button2.Size = new System.Drawing.Size(75, 23);
  190. this.button2.TabIndex = 4;
  191. this.button2.UseVisualStyleBackColor = true;
  192. this.button2.Click += new System.EventHandler(this.button2_Click);
  193. //
  194. // button1
  195. //
  196. this.button1.Location = new System.Drawing.Point(293, 15);
  197. this.button1.Name = "button1";
  198. this.button1.Size = new System.Drawing.Size(75, 23);
  199. this.button1.TabIndex = 3;
  200. this.button1.UseVisualStyleBackColor = true;
  201. this.button1.Click += new System.EventHandler(this.button1_Click);
  202. //
  203. // btn_saveresult
  204. //
  205. this.btn_saveresult.Location = new System.Drawing.Point(472, 15);
  206. this.btn_saveresult.Name = "btn_saveresult";
  207. this.btn_saveresult.Size = new System.Drawing.Size(75, 23);
  208. this.btn_saveresult.TabIndex = 2;
  209. this.btn_saveresult.UseVisualStyleBackColor = true;
  210. this.btn_saveresult.Click += new System.EventHandler(this.btn_saveresult_Click);
  211. //
  212. // groupBox_img
  213. //
  214. this.groupBox_img.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  215. | System.Windows.Forms.AnchorStyles.Left)));
  216. this.groupBox_img.Controls.Add(this.lstView_img);
  217. this.groupBox_img.Location = new System.Drawing.Point(12, 72);
  218. this.groupBox_img.Margin = new System.Windows.Forms.Padding(4);
  219. this.groupBox_img.Name = "groupBox_img";
  220. this.groupBox_img.Padding = new System.Windows.Forms.Padding(4);
  221. this.groupBox_img.Size = new System.Drawing.Size(158, 259);
  222. this.groupBox_img.TabIndex = 14;
  223. this.groupBox_img.TabStop = false;
  224. //
  225. // lstView_img
  226. //
  227. this.lstView_img.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  228. | System.Windows.Forms.AnchorStyles.Left)
  229. | System.Windows.Forms.AnchorStyles.Right)));
  230. this.lstView_img.ItemHeight = 12;
  231. this.lstView_img.Location = new System.Drawing.Point(8, 26);
  232. this.lstView_img.Margin = new System.Windows.Forms.Padding(4);
  233. this.lstView_img.Name = "lstView_img";
  234. this.lstView_img.Size = new System.Drawing.Size(140, 220);
  235. this.lstView_img.TabIndex = 0;
  236. this.lstView_img.SelectedIndexChanged += new System.EventHandler(this.lstView_img_SelectedIndexChanged);
  237. //
  238. // groupBox1
  239. //
  240. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  241. this.groupBox1.Controls.Add(this.label1);
  242. this.groupBox1.Controls.Add(this.groupBox6);
  243. this.groupBox1.Controls.Add(this.groupBox4);
  244. this.groupBox1.Controls.Add(this.panel_showBinaryColor);
  245. this.groupBox1.Controls.Add(this.label_showBinaryColor);
  246. this.groupBox1.Location = new System.Drawing.Point(177, 72);
  247. this.groupBox1.Name = "groupBox1";
  248. this.groupBox1.Size = new System.Drawing.Size(414, 259);
  249. this.groupBox1.TabIndex = 36;
  250. this.groupBox1.TabStop = false;
  251. //
  252. // groupBox6
  253. //
  254. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  255. | System.Windows.Forms.AnchorStyles.Right)));
  256. this.groupBox6.Controls.Add(this.numericUpDown4);
  257. this.groupBox6.Controls.Add(this.numericUpDown3);
  258. this.groupBox6.Controls.Add(this.label5);
  259. this.groupBox6.Controls.Add(this.label6);
  260. this.groupBox6.Location = new System.Drawing.Point(15, 168);
  261. this.groupBox6.Name = "groupBox6";
  262. this.groupBox6.Size = new System.Drawing.Size(385, 47);
  263. this.groupBox6.TabIndex = 42;
  264. this.groupBox6.TabStop = false;
  265. //
  266. // numericUpDown4
  267. //
  268. this.numericUpDown4.Location = new System.Drawing.Point(269, 15);
  269. this.numericUpDown4.Maximum = new decimal(new int[] {
  270. 2147483646,
  271. 0,
  272. 0,
  273. 0});
  274. this.numericUpDown4.Name = "numericUpDown4";
  275. this.numericUpDown4.Size = new System.Drawing.Size(95, 21);
  276. this.numericUpDown4.TabIndex = 12;
  277. //
  278. // numericUpDown3
  279. //
  280. this.numericUpDown3.Location = new System.Drawing.Point(77, 15);
  281. this.numericUpDown3.Maximum = new decimal(new int[] {
  282. 2147483646,
  283. 0,
  284. 0,
  285. 0});
  286. this.numericUpDown3.Name = "numericUpDown3";
  287. this.numericUpDown3.Size = new System.Drawing.Size(98, 21);
  288. this.numericUpDown3.TabIndex = 11;
  289. //
  290. // label5
  291. //
  292. this.label5.AutoSize = true;
  293. this.label5.Location = new System.Drawing.Point(200, 19);
  294. this.label5.Name = "label5";
  295. this.label5.Size = new System.Drawing.Size(47, 12);
  296. this.label5.TabIndex = 11;
  297. //
  298. // label6
  299. //
  300. this.label6.AutoSize = true;
  301. this.label6.Location = new System.Drawing.Point(11, 19);
  302. this.label6.Name = "label6";
  303. this.label6.Size = new System.Drawing.Size(47, 12);
  304. this.label6.TabIndex = 9;
  305. //
  306. // groupBox4
  307. //
  308. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  309. | System.Windows.Forms.AnchorStyles.Right)));
  310. this.groupBox4.Controls.Add(this.numericUpDown6);
  311. this.groupBox4.Controls.Add(this.numericUpDown5);
  312. this.groupBox4.Controls.Add(this.radioButton2);
  313. this.groupBox4.Controls.Add(this.radioButton1);
  314. this.groupBox4.Controls.Add(this.label4);
  315. this.groupBox4.Controls.Add(this.label3);
  316. this.groupBox4.Location = new System.Drawing.Point(16, 85);
  317. this.groupBox4.Name = "groupBox4";
  318. this.groupBox4.Size = new System.Drawing.Size(383, 53);
  319. this.groupBox4.TabIndex = 41;
  320. this.groupBox4.TabStop = false;
  321. //
  322. // numericUpDown6
  323. //
  324. this.numericUpDown6.DecimalPlaces = 10;
  325. this.numericUpDown6.Location = new System.Drawing.Point(268, 16);
  326. this.numericUpDown6.Maximum = new decimal(new int[] {
  327. 214748364,
  328. 0,
  329. 0,
  330. 0});
  331. this.numericUpDown6.Minimum = new decimal(new int[] {
  332. 214748364,
  333. 0,
  334. 0,
  335. -2147483648});
  336. this.numericUpDown6.Name = "numericUpDown6";
  337. this.numericUpDown6.Size = new System.Drawing.Size(98, 21);
  338. this.numericUpDown6.TabIndex = 14;
  339. //
  340. // numericUpDown5
  341. //
  342. this.numericUpDown5.DecimalPlaces = 10;
  343. this.numericUpDown5.Location = new System.Drawing.Point(76, 16);
  344. this.numericUpDown5.Maximum = new decimal(new int[] {
  345. 214748364,
  346. 0,
  347. 0,
  348. 0});
  349. this.numericUpDown5.Minimum = new decimal(new int[] {
  350. 214748364,
  351. 0,
  352. 0,
  353. -2147483648});
  354. this.numericUpDown5.Name = "numericUpDown5";
  355. this.numericUpDown5.Size = new System.Drawing.Size(99, 21);
  356. this.numericUpDown5.TabIndex = 13;
  357. //
  358. // radioButton2
  359. //
  360. this.radioButton2.AutoSize = true;
  361. this.radioButton2.Location = new System.Drawing.Point(202, 16);
  362. this.radioButton2.Name = "radioButton2";
  363. this.radioButton2.Size = new System.Drawing.Size(47, 16);
  364. this.radioButton2.TabIndex = 12;
  365. this.radioButton2.TabStop = true;
  366. this.radioButton2.UseVisualStyleBackColor = true;
  367. //
  368. // radioButton1
  369. //
  370. this.radioButton1.AutoSize = true;
  371. this.radioButton1.Location = new System.Drawing.Point(11, 18);
  372. this.radioButton1.Name = "radioButton1";
  373. this.radioButton1.Size = new System.Drawing.Size(47, 16);
  374. this.radioButton1.TabIndex = 11;
  375. this.radioButton1.TabStop = true;
  376. this.radioButton1.UseVisualStyleBackColor = true;
  377. //
  378. // label4
  379. //
  380. this.label4.AutoSize = true;
  381. this.label4.Location = new System.Drawing.Point(236, 22);
  382. this.label4.Name = "label4";
  383. this.label4.Size = new System.Drawing.Size(0, 12);
  384. this.label4.TabIndex = 7;
  385. //
  386. // label3
  387. //
  388. this.label3.AutoSize = true;
  389. this.label3.Location = new System.Drawing.Point(11, 22);
  390. this.label3.Name = "label3";
  391. this.label3.Size = new System.Drawing.Size(0, 12);
  392. this.label3.TabIndex = 0;
  393. //
  394. // panel_showBinaryColor
  395. //
  396. this.panel_showBinaryColor.BackColor = System.Drawing.Color.Yellow;
  397. this.panel_showBinaryColor.Location = new System.Drawing.Point(62, 27);
  398. this.panel_showBinaryColor.Name = "panel_showBinaryColor";
  399. this.panel_showBinaryColor.Size = new System.Drawing.Size(76, 22);
  400. this.panel_showBinaryColor.TabIndex = 40;
  401. this.panel_showBinaryColor.Click += new System.EventHandler(this.panel_showBinaryColor_Click);
  402. //
  403. // label_showBinaryColor
  404. //
  405. this.label_showBinaryColor.AutoSize = true;
  406. this.label_showBinaryColor.Location = new System.Drawing.Point(14, 37);
  407. this.label_showBinaryColor.Name = "label_showBinaryColor";
  408. this.label_showBinaryColor.Size = new System.Drawing.Size(0, 12);
  409. this.label_showBinaryColor.TabIndex = 39;
  410. //
  411. // groupBox3
  412. //
  413. this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  414. | System.Windows.Forms.AnchorStyles.Right)));
  415. this.groupBox3.Controls.Add(this.panel12);
  416. this.groupBox3.Controls.Add(this.panel11);
  417. this.groupBox3.Controls.Add(this.panel10);
  418. this.groupBox3.Controls.Add(this.panel9);
  419. this.groupBox3.Controls.Add(this.panel8);
  420. this.groupBox3.Controls.Add(this.panel7);
  421. this.groupBox3.Controls.Add(this.panel5);
  422. this.groupBox3.Controls.Add(this.panel6);
  423. this.groupBox3.Controls.Add(this.panel4);
  424. this.groupBox3.Controls.Add(this.panel3);
  425. this.groupBox3.Controls.Add(this.panel2);
  426. this.groupBox3.Controls.Add(this.panel1);
  427. this.groupBox3.Location = new System.Drawing.Point(11, 338);
  428. this.groupBox3.Name = "groupBox3";
  429. this.groupBox3.Size = new System.Drawing.Size(579, 106);
  430. this.groupBox3.TabIndex = 37;
  431. this.groupBox3.TabStop = false;
  432. //
  433. // panel12
  434. //
  435. this.panel12.BackColor = System.Drawing.Color.Yellow;
  436. this.panel12.Location = new System.Drawing.Point(489, 57);
  437. this.panel12.Name = "panel12";
  438. this.panel12.Size = new System.Drawing.Size(76, 22);
  439. this.panel12.TabIndex = 48;
  440. this.panel12.Click += new System.EventHandler(this.panel12_Click);
  441. //
  442. // panel11
  443. //
  444. this.panel11.BackColor = System.Drawing.Color.Yellow;
  445. this.panel11.Location = new System.Drawing.Point(395, 57);
  446. this.panel11.Name = "panel11";
  447. this.panel11.Size = new System.Drawing.Size(76, 22);
  448. this.panel11.TabIndex = 47;
  449. this.panel11.Click += new System.EventHandler(this.panel11_Click);
  450. //
  451. // panel10
  452. //
  453. this.panel10.BackColor = System.Drawing.Color.Yellow;
  454. this.panel10.Location = new System.Drawing.Point(304, 57);
  455. this.panel10.Name = "panel10";
  456. this.panel10.Size = new System.Drawing.Size(76, 22);
  457. this.panel10.TabIndex = 46;
  458. this.panel10.Click += new System.EventHandler(this.panel10_Click);
  459. //
  460. // panel9
  461. //
  462. this.panel9.BackColor = System.Drawing.Color.Yellow;
  463. this.panel9.Location = new System.Drawing.Point(212, 57);
  464. this.panel9.Name = "panel9";
  465. this.panel9.Size = new System.Drawing.Size(76, 22);
  466. this.panel9.TabIndex = 45;
  467. this.panel9.Click += new System.EventHandler(this.panel9_Click);
  468. //
  469. // panel8
  470. //
  471. this.panel8.BackColor = System.Drawing.Color.Yellow;
  472. this.panel8.Location = new System.Drawing.Point(114, 57);
  473. this.panel8.Name = "panel8";
  474. this.panel8.Size = new System.Drawing.Size(76, 22);
  475. this.panel8.TabIndex = 44;
  476. this.panel8.Click += new System.EventHandler(this.panel8_Click);
  477. //
  478. // panel7
  479. //
  480. this.panel7.BackColor = System.Drawing.Color.Yellow;
  481. this.panel7.Location = new System.Drawing.Point(16, 57);
  482. this.panel7.Name = "panel7";
  483. this.panel7.Size = new System.Drawing.Size(76, 22);
  484. this.panel7.TabIndex = 43;
  485. this.panel7.Click += new System.EventHandler(this.panel7_Click);
  486. //
  487. // panel5
  488. //
  489. this.panel5.BackColor = System.Drawing.Color.Yellow;
  490. this.panel5.Location = new System.Drawing.Point(395, 20);
  491. this.panel5.Name = "panel5";
  492. this.panel5.Size = new System.Drawing.Size(76, 22);
  493. this.panel5.TabIndex = 42;
  494. this.panel5.Click += new System.EventHandler(this.panel5_Click);
  495. //
  496. // panel6
  497. //
  498. this.panel6.BackColor = System.Drawing.Color.Yellow;
  499. this.panel6.Location = new System.Drawing.Point(489, 20);
  500. this.panel6.Name = "panel6";
  501. this.panel6.Size = new System.Drawing.Size(76, 22);
  502. this.panel6.TabIndex = 42;
  503. this.panel6.Click += new System.EventHandler(this.panel6_Click);
  504. //
  505. // panel4
  506. //
  507. this.panel4.BackColor = System.Drawing.Color.Yellow;
  508. this.panel4.Location = new System.Drawing.Point(304, 20);
  509. this.panel4.Name = "panel4";
  510. this.panel4.Size = new System.Drawing.Size(76, 22);
  511. this.panel4.TabIndex = 42;
  512. this.panel4.Click += new System.EventHandler(this.panel4_Click);
  513. //
  514. // panel3
  515. //
  516. this.panel3.BackColor = System.Drawing.Color.Yellow;
  517. this.panel3.Location = new System.Drawing.Point(212, 20);
  518. this.panel3.Name = "panel3";
  519. this.panel3.Size = new System.Drawing.Size(76, 22);
  520. this.panel3.TabIndex = 42;
  521. this.panel3.Click += new System.EventHandler(this.panel3_Click);
  522. //
  523. // panel2
  524. //
  525. this.panel2.BackColor = System.Drawing.Color.Yellow;
  526. this.panel2.Location = new System.Drawing.Point(114, 20);
  527. this.panel2.Name = "panel2";
  528. this.panel2.Size = new System.Drawing.Size(76, 22);
  529. this.panel2.TabIndex = 42;
  530. this.panel2.Click += new System.EventHandler(this.panel2_Click);
  531. //
  532. // panel1
  533. //
  534. this.panel1.BackColor = System.Drawing.Color.Yellow;
  535. this.panel1.Location = new System.Drawing.Point(16, 20);
  536. this.panel1.Name = "panel1";
  537. this.panel1.Size = new System.Drawing.Size(76, 22);
  538. this.panel1.TabIndex = 41;
  539. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  540. //
  541. // label1
  542. //
  543. this.label1.AutoSize = true;
  544. this.label1.Location = new System.Drawing.Point(15, 36);
  545. this.label1.Name = "label1";
  546. this.label1.Size = new System.Drawing.Size(29, 12);
  547. this.label1.TabIndex = 43;
  548. //
  549. // PorosityViewSetting
  550. //
  551. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  552. this.ClientSize = new System.Drawing.Size(602, 452);
  553. this.Controls.Add(this.groupBox3);
  554. this.Controls.Add(this.groupBox1);
  555. this.Controls.Add(this.groupBox_img);
  556. this.Controls.Add(this.groupBox_operating);
  557. this.MaximizeBox = false;
  558. this.MinimizeBox = false;
  559. this.Name = "PorosityViewSetting";
  560. this.Controls.SetChildIndex(this.groupBox_operating, 0);
  561. this.Controls.SetChildIndex(this.groupBox_img, 0);
  562. this.Controls.SetChildIndex(this.groupBox1, 0);
  563. this.Controls.SetChildIndex(this.groupBox3, 0);
  564. this.groupBox_operating.ResumeLayout(false);
  565. this.groupBox_img.ResumeLayout(false);
  566. this.groupBox1.ResumeLayout(false);
  567. this.groupBox1.PerformLayout();
  568. this.groupBox6.ResumeLayout(false);
  569. this.groupBox6.PerformLayout();
  570. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
  571. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
  572. this.groupBox4.ResumeLayout(false);
  573. this.groupBox4.PerformLayout();
  574. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
  575. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
  576. this.groupBox3.ResumeLayout(false);
  577. this.ResumeLayout(false);
  578. }
  579. #region [相关事件]
  580. private void setData()
  581. {
  582. panel1.BackColor = Color.FromArgb(ViewSetting.colorFirst);
  583. panel2.BackColor = Color.FromArgb(ViewSetting.colorSecond);
  584. panel3.BackColor = Color.FromArgb(ViewSetting.colorThird);
  585. panel4.BackColor = Color.FromArgb(ViewSetting.colorFourth);
  586. panel5.BackColor = Color.FromArgb(ViewSetting.colorFifth);
  587. panel6.BackColor = Color.FromArgb(ViewSetting.colorSixth);
  588. panel7.BackColor = Color.FromArgb(ViewSetting.colorSeventh);
  589. panel8.BackColor = Color.FromArgb(ViewSetting.colorEighth);
  590. panel9.BackColor = Color.FromArgb(ViewSetting.colorNinth);
  591. panel10.BackColor = Color.FromArgb(ViewSetting.colorTenth);
  592. panel11.BackColor = Color.FromArgb(ViewSetting.colorEleventh);
  593. panel12.BackColor = Color.FromArgb(ViewSetting.colorTwelfth);
  594. panel_showBinaryColor.BackColor = retrunColor(this.chooseIndex);
  595. }
  596. private Color retrunColor(int index)
  597. {
  598. switch ((index + 1) % 12)
  599. {
  600. case 1:
  601. return Color.FromArgb(ViewSetting.colorFirst);
  602. case 2:
  603. return Color.FromArgb(ViewSetting.colorSecond);
  604. case 3:
  605. return Color.FromArgb(ViewSetting.colorThird);
  606. case 4:
  607. return Color.FromArgb(ViewSetting.colorFourth);
  608. case 5:
  609. return Color.FromArgb(ViewSetting.colorFifth);
  610. case 6:
  611. return Color.FromArgb(ViewSetting.colorSixth);
  612. case 7:
  613. return Color.FromArgb(ViewSetting.colorSeventh);
  614. case 8:
  615. return Color.FromArgb(ViewSetting.colorEighth);
  616. case 9:
  617. return Color.FromArgb(ViewSetting.colorNinth);
  618. case 10:
  619. return Color.FromArgb(ViewSetting.colorTenth);
  620. case 11:
  621. return Color.FromArgb(ViewSetting.colorEleventh);
  622. case 12:
  623. return Color.FromArgb(ViewSetting.colorTwelfth);
  624. }
  625. return Color.FromArgb(ViewSetting.colorFirst);
  626. }
  627. private void lstView_img_SelectedIndexChanged(object sender, EventArgs e)
  628. {
  629. this.chooseIndex = this.lstView_img.SelectedIndex;
  630. this.pform.colorHighlight(chooseIndex);
  631. if (chooseIndex == -1)
  632. {
  633. panel_showBinaryColor.BackColor = Color.FromArgb(ViewSetting.colorFirst);
  634. return;
  635. }
  636. panel_showBinaryColor.BackColor = this.drawObjectList[this.chooseIndex].Color;
  637. var type = this.drawObjectList[this.chooseIndex].drawToolType;
  638. if (type == DrawToolType.ViewPolygon || type == DrawToolType.ViewTriangleEx || type == DrawToolType.ViewRectangleEx)
  639. {
  640. numericUpDown5.Enabled = false;
  641. numericUpDown6.Enabled = false;
  642. }
  643. else
  644. {
  645. numericUpDown5.Enabled = true;
  646. numericUpDown6.Enabled = true;
  647. }
  648. this.numericUpDown3.ValueChanged -= new EventHandler(this.numericUpDown3_ValueChange);
  649. this.numericUpDown4.ValueChanged -= new EventHandler(this.numericUpDown4_ValueChange);
  650. this.numericUpDown5.ValueChanged -= new EventHandler(this.numericUpDown5_ValueChange);
  651. this.numericUpDown6.ValueChanged -= new EventHandler(this.numericUpDown6_ValueChange);
  652. //this.numericUpDown5.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit);
  653. //this.numericUpDown6.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit * pxPerUnit);
  654. switch (type)
  655. {
  656. case DrawToolType.ViewOval:
  657. this.radioButton1.Text = PdnResources.GetString("Menu.horizontalaxis.Text");
  658. this.radioButton2.Text = PdnResources.GetString("Menu.verticalaxis.Text");
  659. this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit));
  660. this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit));
  661. break;
  662. case DrawToolType.ViewCircle:
  663. this.radioButton1.Text = PdnResources.GetString("Menu.diameter.text");
  664. this.radioButton2.Text = PdnResources.GetString("Menu.area.text");
  665. this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit));
  666. this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(Math.PI * this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * 0.25 * pxPerUnit * pxPerUnit));
  667. break;
  668. case DrawToolType.ViewRectangle:
  669. this.radioButton2.Text = PdnResources.GetString("Menu.width.text");
  670. this.radioButton1.Text = PdnResources.GetString("Menu.height.text");
  671. this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit));
  672. this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit));
  673. break;
  674. case DrawToolType.ViewRectangleEx:
  675. this.radioButton2.Text = PdnResources.GetString("Menu.width.text");
  676. this.radioButton1.Text = PdnResources.GetString("Menu.height.text");
  677. this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit));
  678. this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit));
  679. break;
  680. case DrawToolType.ViewTriangle:
  681. this.radioButton1.Text = PdnResources.GetString("Menu.Horizontalsidelength.Text");
  682. this.radioButton2.Text = PdnResources.GetString("Menu.Verticalsidelength.Text");
  683. this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit));
  684. this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Width * pxPerUnit));
  685. break;
  686. case DrawToolType.ViewSquare:
  687. this.radioButton1.Text = PdnResources.GetString("Menu.Generalanalysis.Processmparison.Sidelength.text");
  688. this.radioButton2.Text = PdnResources.GetString("Menu.area.text");
  689. this.numericUpDown5.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit));
  690. this.numericUpDown6.Value = Convert.ToDecimal(Math.Ceiling(this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit * pxPerUnit));
  691. break;
  692. case DrawToolType.ViewPolygon:
  693. case DrawToolType.ViewTriangleEx:
  694. this.numericUpDown5.Value = 0;
  695. this.numericUpDown6.Value = 0;
  696. break;
  697. }
  698. int centerX = (int)(this.drawObjectList[this.chooseIndex].Rectangle.X + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Width / 2));
  699. int centerY = (int)(this.drawObjectList[this.chooseIndex].Rectangle.Y + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Height / 2));
  700. this.numericUpDown3.Value = Math.Abs(centerX);
  701. this.numericUpDown4.Value = Math.Abs(centerY);
  702. this.numericUpDown3Old = Math.Abs(centerX);
  703. this.numericUpDown4Old = Math.Abs(centerY);
  704. this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange);
  705. this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange);
  706. this.numericUpDown5.ValueChanged += new EventHandler(this.numericUpDown5_ValueChange);
  707. this.numericUpDown6.ValueChanged += new EventHandler(this.numericUpDown6_ValueChange);
  708. }
  709. /// <summary>
  710. /// 修改中心点x坐标的事件
  711. /// </summary>
  712. /// <param name="sender"></param>
  713. /// <param name="e"></param>
  714. private void numericUpDown3_ValueChange(object sender, EventArgs e)
  715. {
  716. if (this.lstView_img.SelectedIndex == -1) {
  717. return;
  718. }
  719. if (this.numericUpDown3Old != (int)this.numericUpDown3.Value)
  720. {
  721. var id = this.drawObjectList[this.chooseIndex].ID;
  722. this.pform.numericUpDown3_ValueChange(id, this.chooseIndex, (int)this.numericUpDown3.Value, this.numericUpDown3Old);
  723. this.numericUpDown3Old = (int)this.numericUpDown3.Value;
  724. }
  725. }
  726. /// <summary>
  727. /// 修改中心点y坐标的事件
  728. /// </summary>
  729. /// <param name="sender"></param>
  730. /// <param name="e"></param>
  731. private void numericUpDown4_ValueChange(object sender, EventArgs e)
  732. {
  733. if (this.lstView_img.SelectedIndex == -1)
  734. {
  735. return;
  736. }
  737. if (this.numericUpDown4Old != (int)this.numericUpDown4.Value)
  738. {
  739. var id = this.drawObjectList[this.chooseIndex].ID;
  740. this.pform.numericupdown4_valuechange(id, this.chooseIndex, (int)this.numericUpDown4.Value, this.numericUpDown4Old);
  741. this.numericUpDown4Old = (int)this.numericUpDown4.Value;
  742. }
  743. }
  744. /// <summary>
  745. ///
  746. /// </summary>
  747. /// <param name="sender"></param>
  748. /// <param name="e"></param>
  749. private void numericUpDown5_ValueChange(object sender, EventArgs e)
  750. {
  751. if (this.lstView_img.SelectedIndex == -1)
  752. {
  753. return;
  754. }
  755. this.numericUpDown6.ValueChanged -= new EventHandler(this.numericUpDown6_ValueChange);
  756. this.numericUpDown3.ValueChanged -= new EventHandler(this.numericUpDown3_ValueChange);
  757. this.numericUpDown4.ValueChanged -= new EventHandler(this.numericUpDown4_ValueChange);
  758. var id = this.drawObjectList[this.chooseIndex].ID;
  759. this.drawObjectList[this.chooseIndex] = this.pform.numericUpDown5_ValueChange(id, this.chooseIndex, (int)this.numericUpDown5.Value);
  760. int centerX = (int)(this.drawObjectList[this.chooseIndex].Rectangle.X + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Width / 2));
  761. int centerY = (int)(this.drawObjectList[this.chooseIndex].Rectangle.Y + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Height / 2));
  762. this.numericUpDown3.Value = Math.Abs(centerX);
  763. this.numericUpDown4.Value = Math.Abs(centerY);
  764. this.numericUpDown3Old = Math.Abs(centerX);
  765. this.numericUpDown4Old = Math.Abs(centerY);
  766. var type = this.drawObjectList[this.chooseIndex].drawToolType;
  767. switch (type)
  768. {
  769. case DrawToolType.ViewCircle:
  770. this.numericUpDown6.Value = Convert.ToDecimal(Math.PI * this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * 0.25 * pxPerUnit * pxPerUnit);
  771. break;
  772. case DrawToolType.ViewSquare:
  773. this.numericUpDown6.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Height * this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit * pxPerUnit);
  774. break;
  775. }
  776. this.numericUpDown6.ValueChanged += new EventHandler(this.numericUpDown6_ValueChange);
  777. this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange);
  778. this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange);
  779. }
  780. /// <summary>
  781. ///
  782. /// </summary>
  783. /// <param name="sender"></param>
  784. /// <param name="e"></param>
  785. private void numericUpDown6_ValueChange(object sender, EventArgs e)
  786. {
  787. if (this.lstView_img.SelectedIndex == -1)
  788. {
  789. return;
  790. }
  791. this.numericUpDown5.ValueChanged -= new EventHandler(this.numericUpDown5_ValueChange);
  792. this.numericUpDown3.ValueChanged -= new EventHandler(this.numericUpDown3_ValueChange);
  793. this.numericUpDown4.ValueChanged -= new EventHandler(this.numericUpDown4_ValueChange);
  794. var id = this.drawObjectList[this.chooseIndex].ID;
  795. this.drawObjectList[this.chooseIndex] = this.pform.numericUpDown6_ValueChange(id, this.chooseIndex, (int)this.numericUpDown6.Value);
  796. int centerX = (int)(this.drawObjectList[this.chooseIndex].Rectangle.X + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Width / 2));
  797. int centerY = (int)(this.drawObjectList[this.chooseIndex].Rectangle.Y + Math.Abs(this.drawObjectList[this.chooseIndex].Rectangle.Height / 2));
  798. this.numericUpDown3.Value = Math.Abs(centerX);
  799. this.numericUpDown4.Value = Math.Abs(centerY);
  800. this.numericUpDown3Old = Math.Abs(centerX);
  801. this.numericUpDown4Old = Math.Abs(centerY);
  802. var type = this.drawObjectList[this.chooseIndex].drawToolType;
  803. switch (type)
  804. {
  805. case DrawToolType.ViewCircle:
  806. this.numericUpDown5.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit);
  807. break;
  808. case DrawToolType.ViewSquare:
  809. this.numericUpDown5.Value = Convert.ToDecimal(this.drawObjectList[this.chooseIndex].Rectangle.Height * pxPerUnit);
  810. break;
  811. }
  812. this.numericUpDown5.ValueChanged += new EventHandler(this.numericUpDown5_ValueChange);
  813. this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange);
  814. this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange);
  815. }
  816. private void panel_showBinaryColor_Click(object sender, EventArgs e)
  817. {
  818. this.lineColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel_showBinaryColor.BackColor);
  819. this.lineColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.lineColorChanged));
  820. this.lineColorsFormGrid.ShowDialog();
  821. }
  822. private void lineColorChanged(object sender, EventArgs e)
  823. {
  824. if (this.chooseIndex == -1)
  825. {
  826. MessageBox.Show(PdnResources.GetString("Menu.eforechangingthecolor.Text"));
  827. return;
  828. }
  829. Color color = this.lineColorsFormGrid.UserPrimaryColor.ToColor();
  830. //更改背景色,触发事件
  831. this.panel_showBinaryColor.BackColor = color;
  832. this.pform.changeThisColor(this.chooseIndex, color.ToArgb());
  833. //关闭色板
  834. this.lineColorsFormGrid.Close();
  835. }
  836. #region [底部修改视场颜色事件集合]
  837. private void panel1_Click(object sender, EventArgs e)
  838. {
  839. this.cilckNum = 1;
  840. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  841. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  842. this.viewColorsFormGrid.ShowDialog();
  843. }
  844. private void panel2_Click(object sender, EventArgs e)
  845. {
  846. this.cilckNum = 2;
  847. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
  848. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  849. this.viewColorsFormGrid.ShowDialog();
  850. }
  851. private void panel3_Click(object sender, EventArgs e)
  852. {
  853. this.cilckNum = 3;
  854. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel3.BackColor);
  855. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  856. this.viewColorsFormGrid.ShowDialog();
  857. }
  858. private void panel4_Click(object sender, EventArgs e)
  859. {
  860. this.cilckNum = 4;
  861. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel4.BackColor);
  862. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  863. this.viewColorsFormGrid.ShowDialog();
  864. }
  865. private void panel5_Click(object sender, EventArgs e)
  866. {
  867. this.cilckNum = 5;
  868. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel5.BackColor);
  869. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  870. this.viewColorsFormGrid.ShowDialog();
  871. }
  872. private void panel6_Click(object sender, EventArgs e)
  873. {
  874. this.cilckNum = 6;
  875. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel6.BackColor);
  876. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  877. this.viewColorsFormGrid.ShowDialog();
  878. }
  879. private void panel7_Click(object sender, EventArgs e)
  880. {
  881. this.cilckNum = 7;
  882. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel7.BackColor);
  883. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  884. this.viewColorsFormGrid.ShowDialog();
  885. }
  886. private void panel8_Click(object sender, EventArgs e)
  887. {
  888. this.cilckNum = 8;
  889. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel8.BackColor);
  890. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  891. this.viewColorsFormGrid.ShowDialog();
  892. }
  893. private void panel9_Click(object sender, EventArgs e)
  894. {
  895. this.cilckNum = 9;
  896. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel9.BackColor);
  897. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  898. this.viewColorsFormGrid.ShowDialog();
  899. }
  900. private void panel10_Click(object sender, EventArgs e)
  901. {
  902. this.cilckNum = 10;
  903. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel10.BackColor);
  904. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  905. this.viewColorsFormGrid.ShowDialog();
  906. }
  907. private void panel11_Click(object sender, EventArgs e)
  908. {
  909. this.cilckNum = 11;
  910. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel11.BackColor);
  911. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  912. this.viewColorsFormGrid.ShowDialog();
  913. }
  914. private void panel12_Click(object sender, EventArgs e)
  915. {
  916. this.cilckNum = 12;
  917. this.viewColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel12.BackColor);
  918. this.viewColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.viewColorChanged));
  919. this.viewColorsFormGrid.ShowDialog();
  920. }
  921. private void viewColorChanged(object sender, EventArgs e)
  922. {
  923. Color color = this.viewColorsFormGrid.UserPrimaryColor.ToColor();
  924. if (this.cilckNum == 1)
  925. {
  926. ViewSetting.colorFirst = color.ToArgb();
  927. panel1.BackColor = color;
  928. }
  929. else if (this.cilckNum == 2)
  930. {
  931. ViewSetting.colorSecond = color.ToArgb();
  932. panel2.BackColor = color;
  933. }
  934. else if (this.cilckNum == 3)
  935. {
  936. ViewSetting.colorThird = color.ToArgb();
  937. panel3.BackColor = color;
  938. }
  939. else if (this.cilckNum == 4)
  940. {
  941. ViewSetting.colorFourth = color.ToArgb();
  942. panel4.BackColor = color;
  943. }
  944. else if (this.cilckNum == 5)
  945. {
  946. ViewSetting.colorFifth = color.ToArgb();
  947. panel5.BackColor = color;
  948. }
  949. else if (this.cilckNum == 6)
  950. {
  951. ViewSetting.colorSixth = color.ToArgb();
  952. panel6.BackColor = color;
  953. }
  954. else if (this.cilckNum == 7)
  955. {
  956. ViewSetting.colorSeventh = color.ToArgb();
  957. panel7.BackColor = color;
  958. }
  959. else if (this.cilckNum == 8)
  960. {
  961. ViewSetting.colorEighth = color.ToArgb();
  962. panel8.BackColor = color;
  963. }
  964. else if (this.cilckNum == 9)
  965. {
  966. ViewSetting.colorNinth = color.ToArgb();
  967. panel9.BackColor = color;
  968. }
  969. else if (this.cilckNum == 10)
  970. {
  971. ViewSetting.colorTenth = color.ToArgb();
  972. panel10.BackColor = color;
  973. }
  974. else if (this.cilckNum == 11)
  975. {
  976. ViewSetting.colorEleventh = color.ToArgb();
  977. panel11.BackColor = color;
  978. }
  979. else if (this.cilckNum == 0)
  980. {
  981. ViewSetting.colorTwelfth = color.ToArgb();
  982. panel12.BackColor = color;
  983. }
  984. //if ((this.chooseIndex + 1) % 12 == (this.cilckNum % 12)) {
  985. // this.panel_showBinaryColor.BackColor = color;
  986. //}
  987. this.viewColorsFormGrid.Close();
  988. }
  989. #endregion
  990. private void button1_Click(object sender, EventArgs e)
  991. {
  992. this.lstView_img.Items.Clear();
  993. this.pform.clearView();
  994. MessageBox.Show(PdnResources.GetString("Menu.Clearedviewsuccessfully.Text"));
  995. this.Close();
  996. }
  997. private void button2_Click(object sender, EventArgs e)
  998. {
  999. try
  1000. {
  1001. this.pform.clearOneView(this.drawObjectList[this.chooseIndex].ID, this.chooseIndex);
  1002. this.lstView_img.Items.RemoveAt(this.chooseIndex);
  1003. MessageBox.Show(PdnResources.GetString("Menu.Fieldofviewremovedsuccessfully.Text"));
  1004. this.numericUpDown3.ValueChanged -= new EventHandler(this.numericUpDown3_ValueChange);
  1005. this.numericUpDown4.ValueChanged -= new EventHandler(this.numericUpDown4_ValueChange);
  1006. this.numericUpDown5.ValueChanged -= new EventHandler(this.numericUpDown5_ValueChange);
  1007. this.numericUpDown6.ValueChanged -= new EventHandler(this.numericUpDown6_ValueChange);
  1008. this.numericUpDown3.Value = 0;
  1009. this.numericUpDown4.Value = 0;
  1010. this.numericUpDown5.Value = 0;
  1011. this.numericUpDown6.Value = 0;
  1012. this.numericUpDown3.ValueChanged += new EventHandler(this.numericUpDown3_ValueChange);
  1013. this.numericUpDown4.ValueChanged += new EventHandler(this.numericUpDown4_ValueChange);
  1014. this.numericUpDown5.ValueChanged += new EventHandler(this.numericUpDown5_ValueChange);
  1015. this.numericUpDown6.ValueChanged += new EventHandler(this.numericUpDown6_ValueChange);
  1016. }
  1017. catch (Exception ex)
  1018. {
  1019. MessageBox.Show(PdnResources.GetString("Menu.Deletinvifailelate.Text"));
  1020. }
  1021. }
  1022. private void btn_saveresult_Click(object sender, EventArgs e)
  1023. {
  1024. if (this.lstView_img.SelectedIndex == -1) {
  1025. MessageBox.Show("请先选择视场!");
  1026. this.numericUpDown3.Value = 0;
  1027. this.numericUpDown4.Value = 0;
  1028. this.numericUpDown5.Value = 0;
  1029. this.numericUpDown6.Value = 0;
  1030. return;
  1031. }
  1032. string ViewSettingStr = XmlSerializeHelper.XmlSerialize<viewSetting>(this.ViewSetting);
  1033. FileOperationHelper.WriteStringToFile(ViewSettingStr, Application.StartupPath + "\\PorosityConfig\\ViewConfig.xml", FileMode.Create);
  1034. MessageBox.Show(PdnResources.GetString("Menu.Savemodificationsuccessfully.Text"));
  1035. this.pform.editView();
  1036. this.notSave = 2;
  1037. this.Close();
  1038. }
  1039. private void PorosityViewSettingClosing(object sender, EventArgs e)
  1040. {
  1041. //取消高亮
  1042. this.pform.colorHighlight(-1);
  1043. //判断是否是保存后关闭
  1044. if (this.notSave == 1)
  1045. {
  1046. this.pform.returnOldColor();
  1047. }
  1048. }
  1049. #endregion
  1050. }
  1051. }