VermiculateCastIronSetColorDialog.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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.VermiculateCastIron.GBT26656_2011
  11. {
  12. /// <summary>
  13. /// 颜色设置
  14. /// </summary>
  15. internal class VermiculateCastIronSetColorDialog : PdnBaseForm
  16. {
  17. private GroupBox groupBox1;
  18. private GroupBox groupBox2;
  19. private Label label3;
  20. private Label label2;
  21. private Button button2;
  22. private Button button1;
  23. private Panel panel1;
  24. private Panel panel3;
  25. private Panel panel2;
  26. private Label label1;
  27. PaintDotNet.ColorsForm colorsForm1;
  28. PaintDotNet.ColorsForm colorsForm2;
  29. PaintDotNet.ColorsForm colorsForm3;
  30. private VermiculateCastIronGBT26656Classification mainForm;
  31. public VermiculateCastIronSetColorDialog(VermiculateCastIronGBT26656Classification mainForm)
  32. {
  33. this.mainForm = mainForm;
  34. InitializeComponent();
  35. InitializeLanguageText();
  36. InitializeOthers();
  37. }
  38. private void InitializeLanguageText()
  39. {
  40. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  41. this.button2.Text = PdnResources.GetString("ConfirmLanguageDialog.CancelTB.ActionText");
  42. this.button1.Text = PdnResources.GetString("Menu.confirm.Text");
  43. this.groupBox2.Text = PdnResources.GetString("Menu.Colorsetting.text");
  44. this.label3.Text = PdnResources.GetString("Menu.Typeofvermicular.Text") + ":";
  45. this.label2.Text = PdnResources.GetString("Menu.massoffloccule.Text") + ":";
  46. this.label1.Text = PdnResources.GetString("Menu.hballISO945type.Text") + ":";
  47. this.Text = PdnResources.GetString("Menu.Colorsetting.text");
  48. }
  49. private void InitializeComponent()
  50. {
  51. this.groupBox1 = new System.Windows.Forms.GroupBox();
  52. this.button2 = new System.Windows.Forms.Button();
  53. this.button1 = new System.Windows.Forms.Button();
  54. this.groupBox2 = new System.Windows.Forms.GroupBox();
  55. this.panel3 = new System.Windows.Forms.Panel();
  56. this.panel2 = new System.Windows.Forms.Panel();
  57. this.panel1 = new System.Windows.Forms.Panel();
  58. this.label3 = new System.Windows.Forms.Label();
  59. this.label2 = new System.Windows.Forms.Label();
  60. this.label1 = new System.Windows.Forms.Label();
  61. this.groupBox1.SuspendLayout();
  62. this.groupBox2.SuspendLayout();
  63. this.SuspendLayout();
  64. //
  65. // groupBox1
  66. //
  67. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  68. | System.Windows.Forms.AnchorStyles.Right)));
  69. this.groupBox1.Controls.Add(this.button2);
  70. this.groupBox1.Controls.Add(this.button1);
  71. this.groupBox1.Location = new System.Drawing.Point(13, 13);
  72. this.groupBox1.Name = "groupBox1";
  73. this.groupBox1.Size = new System.Drawing.Size(360, 49);
  74. this.groupBox1.TabIndex = 0;
  75. this.groupBox1.TabStop = false;
  76. //
  77. // button2
  78. //
  79. this.button2.Location = new System.Drawing.Point(286, 17);
  80. this.button2.Name = "button2";
  81. this.button2.Size = new System.Drawing.Size(58, 22);
  82. this.button2.TabIndex = 1;
  83. this.button2.UseVisualStyleBackColor = true;
  84. this.button2.Click += new System.EventHandler(this.button2_Click);
  85. //
  86. // button1
  87. //
  88. this.button1.Location = new System.Drawing.Point(206, 17);
  89. this.button1.Name = "button1";
  90. this.button1.Size = new System.Drawing.Size(58, 22);
  91. this.button1.TabIndex = 0;
  92. this.button1.UseVisualStyleBackColor = true;
  93. this.button1.Click += new System.EventHandler(this.button1_Click);
  94. //
  95. // groupBox2
  96. //
  97. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  98. | System.Windows.Forms.AnchorStyles.Left)
  99. | System.Windows.Forms.AnchorStyles.Right)));
  100. this.groupBox2.Controls.Add(this.panel3);
  101. this.groupBox2.Controls.Add(this.panel2);
  102. this.groupBox2.Controls.Add(this.panel1);
  103. this.groupBox2.Controls.Add(this.label3);
  104. this.groupBox2.Controls.Add(this.label2);
  105. this.groupBox2.Controls.Add(this.label1);
  106. this.groupBox2.Location = new System.Drawing.Point(13, 69);
  107. this.groupBox2.Name = "groupBox2";
  108. this.groupBox2.Size = new System.Drawing.Size(360, 103);
  109. this.groupBox2.TabIndex = 1;
  110. this.groupBox2.TabStop = false;
  111. //
  112. // panel3
  113. //
  114. this.panel3.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  115. this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  116. this.panel3.Location = new System.Drawing.Point(255, 76);
  117. this.panel3.Name = "panel3";
  118. this.panel3.Size = new System.Drawing.Size(88, 18);
  119. this.panel3.TabIndex = 5;
  120. this.panel3.Click += new System.EventHandler(this.panel3_Click);
  121. //
  122. // panel2
  123. //
  124. this.panel2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  125. this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  126. this.panel2.Location = new System.Drawing.Point(255, 46);
  127. this.panel2.Name = "panel2";
  128. this.panel2.Size = new System.Drawing.Size(88, 18);
  129. this.panel2.TabIndex = 4;
  130. this.panel2.Click += new System.EventHandler(this.panel2_Click);
  131. //
  132. // panel1
  133. //
  134. this.panel1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  135. this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  136. this.panel1.Location = new System.Drawing.Point(255, 16);
  137. this.panel1.Name = "panel1";
  138. this.panel1.Size = new System.Drawing.Size(88, 18);
  139. this.panel1.TabIndex = 3;
  140. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  141. //
  142. // label3
  143. //
  144. this.label3.AutoSize = true;
  145. this.label3.Location = new System.Drawing.Point(52, 79);
  146. this.label3.Name = "label3";
  147. this.label3.Size = new System.Drawing.Size(161, 12);
  148. this.label3.TabIndex = 2;
  149. //
  150. // label2
  151. //
  152. this.label2.AutoSize = true;
  153. this.label2.Location = new System.Drawing.Point(19, 49);
  154. this.label2.Name = "label2";
  155. this.label2.Size = new System.Drawing.Size(233, 12);
  156. this.label2.TabIndex = 1;
  157. //
  158. // label1
  159. //
  160. this.label1.AutoSize = true;
  161. this.label1.Location = new System.Drawing.Point(60, 19);
  162. this.label1.Name = "label1";
  163. this.label1.Size = new System.Drawing.Size(149, 12);
  164. this.label1.TabIndex = 0;
  165. //
  166. // VermiculateCastIronSetColorDialog
  167. //
  168. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  169. this.ClientSize = new System.Drawing.Size(385, 184);
  170. this.Controls.Add(this.groupBox2);
  171. this.Controls.Add(this.groupBox1);
  172. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  173. this.MaximizeBox = false;
  174. this.MinimizeBox = false;
  175. this.Name = "VermiculateCastIronSetColorDialog";
  176. this.Controls.SetChildIndex(this.groupBox1, 0);
  177. this.Controls.SetChildIndex(this.groupBox2, 0);
  178. this.groupBox1.ResumeLayout(false);
  179. this.groupBox2.ResumeLayout(false);
  180. this.groupBox2.PerformLayout();
  181. this.ResumeLayout(false);
  182. }
  183. private void InitializeOthers()
  184. {
  185. this.colorsForm1 = new ColorsForm();
  186. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  187. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  188. this.colorsForm2 = new ColorsForm();
  189. this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
  190. this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  191. this.colorsForm3 = new ColorsForm();
  192. this.colorsForm3.StartPosition = FormStartPosition.CenterScreen;
  193. this.colorsForm3.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  194. this.panel1.BackColor = this.mainForm.BallColor;
  195. this.panel2.BackColor = this.mainForm.GroupColor;
  196. this.panel3.BackColor = this.mainForm.VermicularColor;
  197. }
  198. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  199. {
  200. }
  201. /// <summary>
  202. /// 取消按钮
  203. /// </summary>
  204. /// <param name="sender"></param>
  205. /// <param name="e"></param>
  206. private void button2_Click(object sender, EventArgs e)
  207. {
  208. this.Close();
  209. }
  210. /// <summary>
  211. /// 确认按钮
  212. /// </summary>
  213. /// <param name="sender"></param>
  214. /// <param name="e"></param>
  215. private void button1_Click(object sender, EventArgs e)
  216. {
  217. this.mainForm.SetVermiculateCastIronColor(this.panel1.BackColor, this.panel2.BackColor, this.panel3.BackColor);
  218. this.Close();
  219. }
  220. /// <summary>
  221. /// 球状颜色
  222. /// </summary>
  223. /// <param name="sender"></param>
  224. /// <param name="e"></param>
  225. private void panel1_Click(object sender, EventArgs e)
  226. {
  227. this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  228. this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
  229. this.colorsForm1.ShowDialog();
  230. }
  231. private void colorsForm1Changed(object sender, EventArgs e)
  232. {
  233. this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
  234. this.colorsForm1.Close();
  235. }
  236. /// <summary>
  237. /// 团状、团絮状颜色
  238. /// </summary>
  239. /// <param name="sender"></param>
  240. /// <param name="e"></param>
  241. private void panel2_Click(object sender, EventArgs e)
  242. {
  243. this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
  244. this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.colorsForm2Changed));
  245. this.colorsForm2.ShowDialog();
  246. }
  247. private void colorsForm2Changed(object sender, EventArgs e)
  248. {
  249. this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
  250. this.colorsForm2.Close();
  251. }
  252. /// <summary>
  253. /// 蠕虫状颜色
  254. /// </summary>
  255. /// <param name="sender"></param>
  256. /// <param name="e"></param>
  257. private void panel3_Click(object sender, EventArgs e)
  258. {
  259. this.colorsForm3.UserPrimaryColor = ColorBgra.FromColor(this.panel3.BackColor);
  260. this.colorsForm3.setSaveBtn_Click(new System.EventHandler(this.colorsForm3Changed));
  261. this.colorsForm3.ShowDialog();
  262. }
  263. private void colorsForm3Changed(object sender, EventArgs e)
  264. {
  265. this.panel3.BackColor = this.colorsForm3.UserPrimaryColor.ToColor();
  266. this.colorsForm3.Close();
  267. }
  268. }
  269. }