ColorSetting.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace PaintDotNet.DedicatedAnalysis.DuctileIron.GBT9441_2009
  11. {
  12. public partial class ColorSetting : Form
  13. {
  14. #region
  15. /// <summary>
  16. /// Required designer variable.
  17. /// </summary>
  18. private System.ComponentModel.IContainer components = null;
  19. /// <summary>
  20. /// Clean up any resources being used.
  21. /// </summary>
  22. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  23. protected override void Dispose(bool disposing)
  24. {
  25. if (disposing && (components != null))
  26. {
  27. components.Dispose();
  28. }
  29. base.Dispose(disposing);
  30. }
  31. #region Windows Form Designer generated code
  32. private void InitializeLanguageText()
  33. {
  34. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  35. this.btnClose.Text = PdnResources.GetString("Menu.File.Close.Text");
  36. this.btnPreservation.Text = PdnResources.GetString("CommonAction.Save");
  37. this.groupBox2.Text = PdnResources.GetString("Menu.Colorsetting.text");
  38. this.Text = PdnResources.GetString("Menu.Colorsetting.text");
  39. }
  40. /// <summary>
  41. /// Required method for Designer support - do not modify
  42. /// the contents of this method with the code editor.
  43. /// </summary>
  44. private void InitializeComponent()
  45. {
  46. this.groupBox1 = new System.Windows.Forms.GroupBox();
  47. this.btnClose = new System.Windows.Forms.Button();
  48. this.btnPreservation = new System.Windows.Forms.Button();
  49. this.groupBox2 = new System.Windows.Forms.GroupBox();
  50. this.panelColour01_0 = new System.Windows.Forms.Panel();
  51. this.label4 = new System.Windows.Forms.Label();
  52. this.panelColour02_01 = new System.Windows.Forms.Panel();
  53. this.label5 = new System.Windows.Forms.Label();
  54. this.panelColour04_02 = new System.Windows.Forms.Panel();
  55. this.label6 = new System.Windows.Forms.Label();
  56. this.panelColour06_04 = new System.Windows.Forms.Panel();
  57. this.label3 = new System.Windows.Forms.Label();
  58. this.panelColour08_06 = new System.Windows.Forms.Panel();
  59. this.label2 = new System.Windows.Forms.Label();
  60. this.panelColour1_08 = new System.Windows.Forms.Panel();
  61. this.label1 = new System.Windows.Forms.Label();
  62. this.groupBox1.SuspendLayout();
  63. this.groupBox2.SuspendLayout();
  64. this.SuspendLayout();
  65. //
  66. // groupBox1
  67. //
  68. this.groupBox1.Controls.Add(this.btnClose);
  69. this.groupBox1.Controls.Add(this.btnPreservation);
  70. this.groupBox1.Location = new System.Drawing.Point(3, 2);
  71. this.groupBox1.Name = "groupBox1";
  72. this.groupBox1.Size = new System.Drawing.Size(597, 64);
  73. this.groupBox1.TabIndex = 0;
  74. this.groupBox1.TabStop = false;
  75. //
  76. // btnClose
  77. //
  78. this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  79. | System.Windows.Forms.AnchorStyles.Right)));
  80. this.btnClose.Location = new System.Drawing.Point(399, 21);
  81. this.btnClose.Name = "btnClose";
  82. this.btnClose.Size = new System.Drawing.Size(84, 30);
  83. this.btnClose.TabIndex = 4;
  84. this.btnClose.UseVisualStyleBackColor = true;
  85. this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
  86. //
  87. // btnPreservation
  88. //
  89. this.btnPreservation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  90. | System.Windows.Forms.AnchorStyles.Right)));
  91. this.btnPreservation.Location = new System.Drawing.Point(500, 21);
  92. this.btnPreservation.Name = "btnPreservation";
  93. this.btnPreservation.Size = new System.Drawing.Size(84, 30);
  94. this.btnPreservation.TabIndex = 3;
  95. this.btnPreservation.UseVisualStyleBackColor = true;
  96. this.btnPreservation.Click += new System.EventHandler(this.btnPreservation_Click);
  97. //
  98. // groupBox2
  99. //
  100. this.groupBox2.Controls.Add(this.panelColour01_0);
  101. this.groupBox2.Controls.Add(this.label4);
  102. this.groupBox2.Controls.Add(this.panelColour02_01);
  103. this.groupBox2.Controls.Add(this.label5);
  104. this.groupBox2.Controls.Add(this.panelColour04_02);
  105. this.groupBox2.Controls.Add(this.label6);
  106. this.groupBox2.Controls.Add(this.panelColour06_04);
  107. this.groupBox2.Controls.Add(this.label3);
  108. this.groupBox2.Controls.Add(this.panelColour08_06);
  109. this.groupBox2.Controls.Add(this.label2);
  110. this.groupBox2.Controls.Add(this.panelColour1_08);
  111. this.groupBox2.Controls.Add(this.label1);
  112. this.groupBox2.Location = new System.Drawing.Point(3, 72);
  113. this.groupBox2.Name = "groupBox2";
  114. this.groupBox2.Size = new System.Drawing.Size(597, 130);
  115. this.groupBox2.TabIndex = 1;
  116. this.groupBox2.TabStop = false;
  117. //
  118. // panelColour01_0
  119. //
  120. this.panelColour01_0.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  121. this.panelColour01_0.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  122. this.panelColour01_0.Location = new System.Drawing.Point(423, 74);
  123. this.panelColour01_0.Name = "panelColour01_0";
  124. this.panelColour01_0.Size = new System.Drawing.Size(70, 28);
  125. this.panelColour01_0.TabIndex = 16;
  126. this.panelColour01_0.Click += new System.EventHandler(this.panelColour01_0_Click);
  127. //
  128. // label4
  129. //
  130. this.label4.AutoSize = true;
  131. this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  132. this.label4.Location = new System.Drawing.Point(361, 80);
  133. this.label4.Name = "label4";
  134. this.label4.Size = new System.Drawing.Size(56, 14);
  135. this.label4.TabIndex = 15;
  136. this.label4.Text = "0.1-0:";
  137. //
  138. // panelColour02_01
  139. //
  140. this.panelColour02_01.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  141. this.panelColour02_01.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  142. this.panelColour02_01.Location = new System.Drawing.Point(249, 74);
  143. this.panelColour02_01.Name = "panelColour02_01";
  144. this.panelColour02_01.Size = new System.Drawing.Size(70, 28);
  145. this.panelColour02_01.TabIndex = 14;
  146. this.panelColour02_01.Click += new System.EventHandler(this.panelColour02_01_Click);
  147. //
  148. // label5
  149. //
  150. this.label5.AutoSize = true;
  151. this.label5.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  152. this.label5.Location = new System.Drawing.Point(187, 80);
  153. this.label5.Name = "label5";
  154. this.label5.Size = new System.Drawing.Size(70, 14);
  155. this.label5.TabIndex = 13;
  156. this.label5.Text = "0.2-0.1:";
  157. //
  158. // panelColour04_02
  159. //
  160. this.panelColour04_02.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  161. this.panelColour04_02.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  162. this.panelColour04_02.Location = new System.Drawing.Point(76, 74);
  163. this.panelColour04_02.Name = "panelColour04_02";
  164. this.panelColour04_02.Size = new System.Drawing.Size(70, 28);
  165. this.panelColour04_02.TabIndex = 12;
  166. this.panelColour04_02.Click += new System.EventHandler(this.panelColour04_02_Click);
  167. //
  168. // label6
  169. //
  170. this.label6.AutoSize = true;
  171. this.label6.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  172. this.label6.Location = new System.Drawing.Point(14, 80);
  173. this.label6.Name = "label6";
  174. this.label6.Size = new System.Drawing.Size(70, 14);
  175. this.label6.TabIndex = 11;
  176. this.label6.Text = "0.4-0.2:";
  177. //
  178. // panelColour06_04
  179. //
  180. this.panelColour06_04.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  181. this.panelColour06_04.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  182. this.panelColour06_04.Location = new System.Drawing.Point(423, 27);
  183. this.panelColour06_04.Name = "panelColour06_04";
  184. this.panelColour06_04.Size = new System.Drawing.Size(70, 28);
  185. this.panelColour06_04.TabIndex = 10;
  186. this.panelColour06_04.Click += new System.EventHandler(this.panelColour06_04_Click);
  187. //
  188. // label3
  189. //
  190. this.label3.AutoSize = true;
  191. this.label3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  192. this.label3.Location = new System.Drawing.Point(361, 33);
  193. this.label3.Name = "label3";
  194. this.label3.Size = new System.Drawing.Size(70, 14);
  195. this.label3.TabIndex = 9;
  196. this.label3.Text = "0.6-0.4:";
  197. //
  198. // panelColour08_06
  199. //
  200. this.panelColour08_06.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  201. this.panelColour08_06.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  202. this.panelColour08_06.Location = new System.Drawing.Point(249, 27);
  203. this.panelColour08_06.Name = "panelColour08_06";
  204. this.panelColour08_06.Size = new System.Drawing.Size(70, 28);
  205. this.panelColour08_06.TabIndex = 8;
  206. this.panelColour08_06.Click += new System.EventHandler(this.panelColour08_06_Click);
  207. //
  208. // label2
  209. //
  210. this.label2.AutoSize = true;
  211. this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  212. this.label2.Location = new System.Drawing.Point(187, 33);
  213. this.label2.Name = "label2";
  214. this.label2.Size = new System.Drawing.Size(70, 14);
  215. this.label2.TabIndex = 7;
  216. this.label2.Text = "0.8-0.6:";
  217. //
  218. // panelColour1_08
  219. //
  220. this.panelColour1_08.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  221. this.panelColour1_08.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  222. this.panelColour1_08.Location = new System.Drawing.Point(76, 27);
  223. this.panelColour1_08.Name = "panelColour1_08";
  224. this.panelColour1_08.Size = new System.Drawing.Size(70, 28);
  225. this.panelColour1_08.TabIndex = 6;
  226. this.panelColour1_08.Click += new System.EventHandler(this.panelColour1_08_Click);
  227. //
  228. // label1
  229. //
  230. this.label1.AutoSize = true;
  231. this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  232. this.label1.Location = new System.Drawing.Point(14, 33);
  233. this.label1.Name = "label1";
  234. this.label1.Size = new System.Drawing.Size(56, 14);
  235. this.label1.TabIndex = 0;
  236. this.label1.Text = "1-0.8:";
  237. //
  238. // ColorSetting
  239. //
  240. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  241. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  242. this.ClientSize = new System.Drawing.Size(604, 214);
  243. this.Controls.Add(this.groupBox2);
  244. this.Controls.Add(this.groupBox1);
  245. this.MaximizeBox = false;
  246. this.MinimizeBox = false;
  247. this.Name = "ColorSetting";
  248. this.groupBox1.ResumeLayout(false);
  249. this.groupBox2.ResumeLayout(false);
  250. this.groupBox2.PerformLayout();
  251. this.ResumeLayout(false);
  252. }
  253. #endregion
  254. private System.Windows.Forms.GroupBox groupBox1;
  255. private System.Windows.Forms.Button btnClose;
  256. private System.Windows.Forms.Button btnPreservation;
  257. private System.Windows.Forms.GroupBox groupBox2;
  258. private System.Windows.Forms.Label label1;
  259. private System.Windows.Forms.Panel panelColour01_0;
  260. private System.Windows.Forms.Label label4;
  261. private System.Windows.Forms.Panel panelColour02_01;
  262. private System.Windows.Forms.Label label5;
  263. private System.Windows.Forms.Panel panelColour04_02;
  264. private System.Windows.Forms.Label label6;
  265. private System.Windows.Forms.Panel panelColour06_04;
  266. private System.Windows.Forms.Label label3;
  267. private System.Windows.Forms.Panel panelColour08_06;
  268. private System.Windows.Forms.Label label2;
  269. private System.Windows.Forms.Panel panelColour1_08;
  270. #endregion
  271. /// <summary>
  272. /// 调色板
  273. /// </summary>
  274. PaintDotNet.ColorsForm colorsForm1_08;
  275. PaintDotNet.ColorsForm colorsForm08_06;
  276. PaintDotNet.ColorsForm colorsForm06_04;
  277. PaintDotNet.ColorsForm colorsForm04_02;
  278. PaintDotNet.ColorsForm colorsForm02_01;
  279. PaintDotNet.ColorsForm colorsForm01_0;
  280. public ColorSetting()
  281. {
  282. InitializeComponent();
  283. InitializeLanguageText();
  284. InitOtherTools();
  285. }
  286. private void InitOtherTools()
  287. {
  288. //
  289. //调色板
  290. //
  291. this.colorsForm1_08 = new ColorsForm();
  292. this.colorsForm1_08.StartPosition = FormStartPosition.CenterScreen;
  293. this.colorsForm1_08.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  294. this.colorsForm08_06 = new ColorsForm();
  295. this.colorsForm08_06.StartPosition = FormStartPosition.CenterScreen;
  296. this.colorsForm08_06.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  297. this.colorsForm06_04 = new ColorsForm();
  298. this.colorsForm06_04.StartPosition = FormStartPosition.CenterScreen;
  299. this.colorsForm06_04.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  300. this.colorsForm04_02 = new ColorsForm();
  301. this.colorsForm04_02.StartPosition = FormStartPosition.CenterScreen;
  302. this.colorsForm04_02.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  303. this.colorsForm02_01 = new ColorsForm();
  304. this.colorsForm02_01.StartPosition = FormStartPosition.CenterScreen;
  305. this.colorsForm02_01.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  306. this.colorsForm01_0 = new ColorsForm();
  307. this.colorsForm01_0.StartPosition = FormStartPosition.CenterScreen;
  308. this.colorsForm01_0.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  309. if (SpheroidizationLevelDialog.spheroidizationLevelDialog.colour != null)
  310. {
  311. this.panelColour1_08.BackColor = SpheroidizationLevelDialog.spheroidizationLevelDialog.colour["panelColour1_08"];;
  312. this.panelColour08_06.BackColor = SpheroidizationLevelDialog.spheroidizationLevelDialog.colour["panelColour08_06"];
  313. this.panelColour06_04.BackColor = SpheroidizationLevelDialog.spheroidizationLevelDialog.colour["panelColour06_04"];
  314. this.panelColour04_02.BackColor = SpheroidizationLevelDialog.spheroidizationLevelDialog.colour["panelColour04_02"];
  315. this.panelColour02_01.BackColor = SpheroidizationLevelDialog.spheroidizationLevelDialog.colour["panelColour02_01"];
  316. this.panelColour01_0.BackColor = SpheroidizationLevelDialog.spheroidizationLevelDialog.colour["panelColour01_0"];
  317. }
  318. else
  319. {
  320. this.panelColour1_08.BackColor = Color.Orange;
  321. this.panelColour08_06.BackColor = Color.Blue;
  322. this.panelColour06_04.BackColor = Color.Green;
  323. this.panelColour04_02.BackColor = Color.Pink;
  324. this.panelColour02_01.BackColor = Color.Violet;
  325. this.panelColour01_0.BackColor = Color.Yellow;
  326. }
  327. }
  328. private void panelColour1_08_Click(object sender, EventArgs e)
  329. {
  330. this.colorsForm1_08.UserPrimaryColor = ColorBgra.FromColor(this.panelColour1_08.BackColor);
  331. this.colorsForm1_08.setSaveBtn_Click(new System.EventHandler(this.colorsForm1_08Changed));
  332. this.colorsForm1_08.ShowDialog();
  333. }
  334. private void colorsForm1_08Changed(object sender, EventArgs e)
  335. {
  336. this.panelColour1_08.BackColor = this.colorsForm1_08.UserPrimaryColor.ToColor();
  337. this.colorsForm1_08.Close();
  338. }
  339. /// <summary>
  340. /// 调色板回调函数
  341. /// </summary>
  342. /// <param name="sender"></param>
  343. /// <param name="ce"></param>
  344. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  345. {
  346. }
  347. private void panelColour08_06_Click(object sender, EventArgs e)
  348. {
  349. this.colorsForm08_06.UserPrimaryColor = ColorBgra.FromColor(this.panelColour08_06.BackColor);
  350. this.colorsForm08_06.setSaveBtn_Click(new System.EventHandler(this.colorsForm08_06Changed));
  351. this.colorsForm08_06.ShowDialog();
  352. }
  353. private void colorsForm08_06Changed(object sender, EventArgs e)
  354. {
  355. this.panelColour08_06.BackColor = this.colorsForm08_06.UserPrimaryColor.ToColor();
  356. this.colorsForm08_06.Close();
  357. }
  358. private void panelColour06_04_Click(object sender, EventArgs e)
  359. {
  360. this.colorsForm06_04.UserPrimaryColor = ColorBgra.FromColor(this.panelColour06_04.BackColor);
  361. this.colorsForm06_04.setSaveBtn_Click(new System.EventHandler(this.colorsForm06_04Changed));
  362. this.colorsForm06_04.ShowDialog();
  363. }
  364. private void colorsForm06_04Changed(object sender, EventArgs e)
  365. {
  366. this.panelColour06_04.BackColor = this.colorsForm06_04.UserPrimaryColor.ToColor();
  367. this.colorsForm06_04.Close();
  368. }
  369. private void panelColour04_02_Click(object sender, EventArgs e)
  370. {
  371. this.colorsForm04_02.UserPrimaryColor = ColorBgra.FromColor(this.panelColour04_02.BackColor);
  372. this.colorsForm04_02.setSaveBtn_Click(new System.EventHandler(this.colorsForm04_02Changed));
  373. this.colorsForm04_02.ShowDialog();
  374. }
  375. private void colorsForm04_02Changed(object sender, EventArgs e)
  376. {
  377. this.panelColour04_02.BackColor = this.colorsForm04_02.UserPrimaryColor.ToColor();
  378. this.colorsForm04_02.Close();
  379. }
  380. private void panelColour02_01_Click(object sender, EventArgs e)
  381. {
  382. this.colorsForm02_01.UserPrimaryColor = ColorBgra.FromColor(this.panelColour02_01.BackColor);
  383. this.colorsForm02_01.setSaveBtn_Click(new System.EventHandler(this.colorsForm02_01Changed));
  384. this.colorsForm02_01.ShowDialog();
  385. }
  386. private void colorsForm02_01Changed(object sender, EventArgs e)
  387. {
  388. this.panelColour02_01.BackColor = this.colorsForm02_01.UserPrimaryColor.ToColor();
  389. this.colorsForm02_01.Close();
  390. }
  391. private void panelColour01_0_Click(object sender, EventArgs e)
  392. {
  393. this.colorsForm01_0.UserPrimaryColor = ColorBgra.FromColor(this.panelColour01_0.BackColor);
  394. this.colorsForm01_0.setSaveBtn_Click(new System.EventHandler(this.colorsForm01_0Changed));
  395. this.colorsForm01_0.ShowDialog();
  396. }
  397. private void colorsForm01_0Changed(object sender, EventArgs e)
  398. {
  399. this.panelColour01_0.BackColor = this.colorsForm01_0.UserPrimaryColor.ToColor();
  400. this.colorsForm01_0.Close();
  401. }
  402. private void btnClose_Click(object sender, EventArgs e)
  403. {
  404. this.Close();
  405. }
  406. private void btnPreservation_Click(object sender, EventArgs e)
  407. {
  408. SpheroidizationLevelDialog.spheroidizationLevelDialog.colour.Clear();
  409. foreach (Control panel in groupBox2.Controls)
  410. {
  411. if (panel is Panel)
  412. {
  413. SpheroidizationLevelDialog.spheroidizationLevelDialog.colour.Add(panel.Name, panel.BackColor);
  414. }
  415. }
  416. if (SpheroidizationLevelDialog.spheroidizationLevelDialog.checkBox4.Checked)
  417. {
  418. SpheroidizationLevelDialog.spheroidizationLevelDialog.DisplayColor();
  419. SpheroidizationLevelDialog.spheroidizationLevelDialog.documentWorkspace.Refresh();
  420. }
  421. this.Close();
  422. }
  423. }
  424. }