ColorSetting.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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.ISO945
  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.groupBox2.Text = PdnResources.GetString("Menu.Colorsetting.text");
  35. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  36. this.btnClose.Text = PdnResources.GetString("Menu.File.Close.Text");
  37. this.btnPreservation.Text = PdnResources.GetString("CommonAction.Save");
  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.groupBox2 = new System.Windows.Forms.GroupBox();
  47. this.panelColour6 = new System.Windows.Forms.Panel();
  48. this.label4 = new System.Windows.Forms.Label();
  49. this.panelColour5 = new System.Windows.Forms.Panel();
  50. this.label5 = new System.Windows.Forms.Label();
  51. this.panelColour4 = new System.Windows.Forms.Panel();
  52. this.label6 = new System.Windows.Forms.Label();
  53. this.panelColour3 = new System.Windows.Forms.Panel();
  54. this.label3 = new System.Windows.Forms.Label();
  55. this.panelColour2 = new System.Windows.Forms.Panel();
  56. this.label2 = new System.Windows.Forms.Label();
  57. this.panelColour1 = new System.Windows.Forms.Panel();
  58. this.label1 = new System.Windows.Forms.Label();
  59. this.groupBox1 = new System.Windows.Forms.GroupBox();
  60. this.btnClose = new System.Windows.Forms.Button();
  61. this.btnPreservation = new System.Windows.Forms.Button();
  62. this.groupBox2.SuspendLayout();
  63. this.groupBox1.SuspendLayout();
  64. this.SuspendLayout();
  65. //
  66. // groupBox2
  67. //
  68. this.groupBox2.Controls.Add(this.panelColour6);
  69. this.groupBox2.Controls.Add(this.label4);
  70. this.groupBox2.Controls.Add(this.panelColour5);
  71. this.groupBox2.Controls.Add(this.label5);
  72. this.groupBox2.Controls.Add(this.panelColour4);
  73. this.groupBox2.Controls.Add(this.label6);
  74. this.groupBox2.Controls.Add(this.panelColour3);
  75. this.groupBox2.Controls.Add(this.label3);
  76. this.groupBox2.Controls.Add(this.panelColour2);
  77. this.groupBox2.Controls.Add(this.label2);
  78. this.groupBox2.Controls.Add(this.panelColour1);
  79. this.groupBox2.Controls.Add(this.label1);
  80. this.groupBox2.Location = new System.Drawing.Point(3, 72);
  81. this.groupBox2.Name = "groupBox2";
  82. this.groupBox2.Size = new System.Drawing.Size(597, 130);
  83. this.groupBox2.TabIndex = 3;
  84. this.groupBox2.TabStop = false;
  85. //
  86. // panelColour6
  87. //
  88. this.panelColour6.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  89. this.panelColour6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  90. this.panelColour6.Location = new System.Drawing.Point(423, 74);
  91. this.panelColour6.Name = "panelColour6";
  92. this.panelColour6.Size = new System.Drawing.Size(70, 28);
  93. this.panelColour6.TabIndex = 16;
  94. this.panelColour6.Click += new System.EventHandler(this.panelColour6_Click);
  95. //
  96. // label4
  97. //
  98. this.label4.AutoSize = true;
  99. this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  100. this.label4.Location = new System.Drawing.Point(382, 80);
  101. this.label4.Name = "label4";
  102. this.label4.Size = new System.Drawing.Size(35, 14);
  103. this.label4.TabIndex = 15;
  104. this.label4.Text = "Ⅵ:";
  105. //
  106. // panelColour5
  107. //
  108. this.panelColour5.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  109. this.panelColour5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  110. this.panelColour5.Location = new System.Drawing.Point(249, 74);
  111. this.panelColour5.Name = "panelColour5";
  112. this.panelColour5.Size = new System.Drawing.Size(70, 28);
  113. this.panelColour5.TabIndex = 14;
  114. this.panelColour5.Click += new System.EventHandler(this.panelColour5_Click);
  115. //
  116. // label5
  117. //
  118. this.label5.AutoSize = true;
  119. this.label5.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  120. this.label5.Location = new System.Drawing.Point(207, 80);
  121. this.label5.Name = "label5";
  122. this.label5.Size = new System.Drawing.Size(35, 14);
  123. this.label5.TabIndex = 13;
  124. this.label5.Text = "Ⅴ:";
  125. //
  126. // panelColour4
  127. //
  128. this.panelColour4.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  129. this.panelColour4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  130. this.panelColour4.Location = new System.Drawing.Point(76, 74);
  131. this.panelColour4.Name = "panelColour4";
  132. this.panelColour4.Size = new System.Drawing.Size(70, 28);
  133. this.panelColour4.TabIndex = 12;
  134. this.panelColour4.Click += new System.EventHandler(this.panelColour4_Click);
  135. //
  136. // label6
  137. //
  138. this.label6.AutoSize = true;
  139. this.label6.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  140. this.label6.Location = new System.Drawing.Point(33, 80);
  141. this.label6.Name = "label6";
  142. this.label6.Size = new System.Drawing.Size(35, 14);
  143. this.label6.TabIndex = 11;
  144. this.label6.Text = "Ⅳ:";
  145. //
  146. // panelColour3
  147. //
  148. this.panelColour3.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  149. this.panelColour3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  150. this.panelColour3.Location = new System.Drawing.Point(423, 27);
  151. this.panelColour3.Name = "panelColour3";
  152. this.panelColour3.Size = new System.Drawing.Size(70, 28);
  153. this.panelColour3.TabIndex = 10;
  154. this.panelColour3.Click += new System.EventHandler(this.panelColour3_Click);
  155. //
  156. // label3
  157. //
  158. this.label3.AutoSize = true;
  159. this.label3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  160. this.label3.Location = new System.Drawing.Point(382, 33);
  161. this.label3.Name = "label3";
  162. this.label3.Size = new System.Drawing.Size(35, 14);
  163. this.label3.TabIndex = 9;
  164. this.label3.Text = "Ⅲ:";
  165. //
  166. // panelColour2
  167. //
  168. this.panelColour2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  169. this.panelColour2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  170. this.panelColour2.Location = new System.Drawing.Point(249, 27);
  171. this.panelColour2.Name = "panelColour2";
  172. this.panelColour2.Size = new System.Drawing.Size(70, 28);
  173. this.panelColour2.TabIndex = 8;
  174. this.panelColour2.Click += new System.EventHandler(this.panelColour2_Click);
  175. //
  176. // label2
  177. //
  178. this.label2.AutoSize = true;
  179. this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  180. this.label2.Location = new System.Drawing.Point(207, 33);
  181. this.label2.Name = "label2";
  182. this.label2.Size = new System.Drawing.Size(35, 14);
  183. this.label2.TabIndex = 7;
  184. this.label2.Text = "Ⅱ:";
  185. //
  186. // panelColour1
  187. //
  188. this.panelColour1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  189. this.panelColour1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  190. this.panelColour1.Location = new System.Drawing.Point(76, 27);
  191. this.panelColour1.Name = "panelColour1";
  192. this.panelColour1.Size = new System.Drawing.Size(70, 28);
  193. this.panelColour1.TabIndex = 6;
  194. this.panelColour1.Click += new System.EventHandler(this.panelColour1_Click);
  195. //
  196. // label1
  197. //
  198. this.label1.AutoSize = true;
  199. this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  200. this.label1.Location = new System.Drawing.Point(33, 33);
  201. this.label1.Name = "label1";
  202. this.label1.Size = new System.Drawing.Size(35, 14);
  203. this.label1.TabIndex = 0;
  204. this.label1.Text = "Ⅰ:";
  205. //
  206. // groupBox1
  207. //
  208. this.groupBox1.Controls.Add(this.btnClose);
  209. this.groupBox1.Controls.Add(this.btnPreservation);
  210. this.groupBox1.Location = new System.Drawing.Point(3, 2);
  211. this.groupBox1.Name = "groupBox1";
  212. this.groupBox1.Size = new System.Drawing.Size(597, 64);
  213. this.groupBox1.TabIndex = 2;
  214. this.groupBox1.TabStop = false;
  215. //
  216. // btnClose
  217. //
  218. this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  219. | System.Windows.Forms.AnchorStyles.Right)));
  220. this.btnClose.Location = new System.Drawing.Point(399, 21);
  221. this.btnClose.Name = "btnClose";
  222. this.btnClose.Size = new System.Drawing.Size(84, 30);
  223. this.btnClose.TabIndex = 4;
  224. this.btnClose.UseVisualStyleBackColor = true;
  225. this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
  226. //
  227. // btnPreservation
  228. //
  229. this.btnPreservation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  230. | System.Windows.Forms.AnchorStyles.Right)));
  231. this.btnPreservation.Location = new System.Drawing.Point(500, 21);
  232. this.btnPreservation.Name = "btnPreservation";
  233. this.btnPreservation.Size = new System.Drawing.Size(84, 30);
  234. this.btnPreservation.TabIndex = 3;
  235. this.btnPreservation.UseVisualStyleBackColor = true;
  236. this.btnPreservation.Click += new System.EventHandler(this.btnPreservation_Click);
  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.groupBox2.ResumeLayout(false);
  249. this.groupBox2.PerformLayout();
  250. this.groupBox1.ResumeLayout(false);
  251. this.ResumeLayout(false);
  252. }
  253. #endregion
  254. private System.Windows.Forms.GroupBox groupBox2;
  255. private System.Windows.Forms.Panel panelColour6;
  256. private System.Windows.Forms.Label label4;
  257. private System.Windows.Forms.Panel panelColour5;
  258. private System.Windows.Forms.Label label5;
  259. private System.Windows.Forms.Panel panelColour4;
  260. private System.Windows.Forms.Label label6;
  261. private System.Windows.Forms.Panel panelColour3;
  262. private System.Windows.Forms.Label label3;
  263. private System.Windows.Forms.Panel panelColour2;
  264. private System.Windows.Forms.Label label2;
  265. private System.Windows.Forms.Panel panelColour1;
  266. private System.Windows.Forms.Label label1;
  267. private System.Windows.Forms.GroupBox groupBox1;
  268. private System.Windows.Forms.Button btnClose;
  269. private System.Windows.Forms.Button btnPreservation;
  270. #endregion
  271. /// <summary>
  272. /// 调色板
  273. /// </summary>
  274. PaintDotNet.ColorsForm colorsForm1;
  275. PaintDotNet.ColorsForm colorsForm2;
  276. PaintDotNet.ColorsForm colorsForm3;
  277. PaintDotNet.ColorsForm colorsForm4;
  278. PaintDotNet.ColorsForm colorsForm5;
  279. PaintDotNet.ColorsForm colorsForm6;
  280. public ColorSetting()
  281. {
  282. InitializeComponent();
  283. InitializeLanguageText();
  284. InitOtherTools();
  285. }
  286. private void InitOtherTools()
  287. {
  288. //
  289. //调色板
  290. //
  291. this.colorsForm1 = new ColorsForm();
  292. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  293. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  294. this.colorsForm2 = new ColorsForm();
  295. this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
  296. this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  297. this.colorsForm3 = new ColorsForm();
  298. this.colorsForm3.StartPosition = FormStartPosition.CenterScreen;
  299. this.colorsForm3.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  300. this.colorsForm4 = new ColorsForm();
  301. this.colorsForm4.StartPosition = FormStartPosition.CenterScreen;
  302. this.colorsForm4.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  303. this.colorsForm5 = new ColorsForm();
  304. this.colorsForm5.StartPosition = FormStartPosition.CenterScreen;
  305. this.colorsForm5.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  306. this.colorsForm6 = new ColorsForm();
  307. this.colorsForm6.StartPosition = FormStartPosition.CenterScreen;
  308. this.colorsForm6.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  309. if (SpheroidizationTypeDialog.spheroidizationTypeDialog.colour != null)
  310. {
  311. this.panelColour1.BackColor = SpheroidizationTypeDialog.spheroidizationTypeDialog.colour["panelColour1"]; ;
  312. this.panelColour2.BackColor = SpheroidizationTypeDialog.spheroidizationTypeDialog.colour["panelColour2"];
  313. this.panelColour3.BackColor = SpheroidizationTypeDialog.spheroidizationTypeDialog.colour["panelColour3"];
  314. this.panelColour4.BackColor = SpheroidizationTypeDialog.spheroidizationTypeDialog.colour["panelColour4"];
  315. this.panelColour5.BackColor = SpheroidizationTypeDialog.spheroidizationTypeDialog.colour["panelColour5"];
  316. this.panelColour6.BackColor = SpheroidizationTypeDialog.spheroidizationTypeDialog.colour["panelColour6"];
  317. }
  318. else
  319. {
  320. this.panelColour1.BackColor = Color.Orange;
  321. this.panelColour2.BackColor = Color.Blue;
  322. this.panelColour3.BackColor = Color.Green;
  323. this.panelColour4.BackColor = Color.Pink;
  324. this.panelColour5.BackColor = Color.Violet;
  325. this.panelColour6.BackColor = Color.Yellow;
  326. }
  327. }
  328. /// <summary>
  329. /// 调色板回调函数
  330. /// </summary>
  331. /// <param name="sender"></param>
  332. /// <param name="ce"></param>
  333. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  334. {
  335. }
  336. private void panelColour1_Click(object sender, EventArgs e)
  337. {
  338. this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panelColour1.BackColor);
  339. this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
  340. this.colorsForm1.ShowDialog();
  341. }
  342. private void colorsForm1Changed(object sender, EventArgs e)
  343. {
  344. this.panelColour1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
  345. this.colorsForm1.Close();
  346. }
  347. private void panelColour2_Click(object sender, EventArgs e)
  348. {
  349. this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panelColour2.BackColor);
  350. this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.colorsForm2Changed));
  351. this.colorsForm2.ShowDialog();
  352. }
  353. private void colorsForm2Changed(object sender, EventArgs e)
  354. {
  355. this.panelColour2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
  356. this.colorsForm2.Close();
  357. }
  358. private void panelColour3_Click(object sender, EventArgs e)
  359. {
  360. this.colorsForm3.UserPrimaryColor = ColorBgra.FromColor(this.panelColour3.BackColor);
  361. this.colorsForm3.setSaveBtn_Click(new System.EventHandler(this.colorsForm3Changed));
  362. this.colorsForm3.ShowDialog();
  363. }
  364. private void colorsForm3Changed(object sender, EventArgs e)
  365. {
  366. this.panelColour3.BackColor = this.colorsForm3.UserPrimaryColor.ToColor();
  367. this.colorsForm3.Close();
  368. }
  369. private void panelColour4_Click(object sender, EventArgs e)
  370. {
  371. this.colorsForm4.UserPrimaryColor = ColorBgra.FromColor(this.panelColour4.BackColor);
  372. this.colorsForm4.setSaveBtn_Click(new System.EventHandler(this.colorsForm4Changed));
  373. this.colorsForm4.ShowDialog();
  374. }
  375. private void colorsForm4Changed(object sender, EventArgs e)
  376. {
  377. this.panelColour4.BackColor = this.colorsForm4.UserPrimaryColor.ToColor();
  378. this.colorsForm4.Close();
  379. }
  380. private void panelColour5_Click(object sender, EventArgs e)
  381. {
  382. this.colorsForm5.UserPrimaryColor = ColorBgra.FromColor(this.panelColour5.BackColor);
  383. this.colorsForm5.setSaveBtn_Click(new System.EventHandler(this.colorsForm5Changed));
  384. this.colorsForm5.ShowDialog();
  385. }
  386. private void colorsForm5Changed(object sender, EventArgs e)
  387. {
  388. this.panelColour5.BackColor = this.colorsForm5.UserPrimaryColor.ToColor();
  389. this.colorsForm5.Close();
  390. }
  391. private void panelColour6_Click(object sender, EventArgs e)
  392. {
  393. this.colorsForm6.UserPrimaryColor = ColorBgra.FromColor(this.panelColour6.BackColor);
  394. this.colorsForm6.setSaveBtn_Click(new System.EventHandler(this.colorsForm6Changed));
  395. this.colorsForm6.ShowDialog();
  396. }
  397. private void colorsForm6Changed(object sender, EventArgs e)
  398. {
  399. this.panelColour6.BackColor = this.colorsForm6.UserPrimaryColor.ToColor();
  400. this.colorsForm6.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. SpheroidizationTypeDialog.spheroidizationTypeDialog.colour.Clear();
  409. foreach (Control panel in groupBox2.Controls)
  410. {
  411. if (panel is Panel)
  412. {
  413. SpheroidizationTypeDialog.spheroidizationTypeDialog.colour.Add(panel.Name, panel.BackColor);
  414. }
  415. }
  416. if (SpheroidizationTypeDialog.spheroidizationTypeDialog.checkBox4.Checked)
  417. {
  418. SpheroidizationTypeDialog.spheroidizationTypeDialog.DisplayColor();
  419. SpheroidizationTypeDialog.spheroidizationTypeDialog.documentWorkspace.Refresh();
  420. }
  421. this.Close();
  422. }
  423. }
  424. }