DisplaySetting.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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.GraphiteSize
  11. {
  12. public class DisplaySetting : 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.label2.Text = PdnResources.GetString("Menu.fontcolor.text");
  35. this.groupBox2.Text = PdnResources.GetString("Menu.Colorsetting.text");
  36. this.label1.Text = PdnResources.GetString("Menu.Fontsize.text");
  37. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  38. this.btnClose.Text = PdnResources.GetString("Menu.File.Close.Text");
  39. this.btnPreservation.Text = PdnResources.GetString("CommonAction.Save");
  40. this.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
  41. }
  42. /// <summary>
  43. /// Required method for Designer support - do not modify
  44. /// the contents of this method with the code editor.
  45. /// </summary>
  46. private void InitializeComponent()
  47. {
  48. this.groupBox2 = new System.Windows.Forms.GroupBox();
  49. this.comboFontSize = new System.Windows.Forms.NumericUpDown();
  50. this.label2 = new System.Windows.Forms.Label();
  51. this.label1 = new System.Windows.Forms.Label();
  52. this.panelColour = new System.Windows.Forms.Panel();
  53. this.groupBox1 = new System.Windows.Forms.GroupBox();
  54. this.btnClose = new System.Windows.Forms.Button();
  55. this.btnPreservation = new System.Windows.Forms.Button();
  56. this.groupBox2.SuspendLayout();
  57. ((System.ComponentModel.ISupportInitialize)(this.comboFontSize)).BeginInit();
  58. this.groupBox1.SuspendLayout();
  59. this.SuspendLayout();
  60. //
  61. // groupBox2
  62. //
  63. this.groupBox2.Controls.Add(this.comboFontSize);
  64. this.groupBox2.Controls.Add(this.label2);
  65. this.groupBox2.Controls.Add(this.label1);
  66. this.groupBox2.Controls.Add(this.panelColour);
  67. this.groupBox2.Location = new System.Drawing.Point(4, 77);
  68. this.groupBox2.Name = "groupBox2";
  69. this.groupBox2.Size = new System.Drawing.Size(597, 130);
  70. this.groupBox2.TabIndex = 4;
  71. this.groupBox2.TabStop = false;
  72. //
  73. // comboFontSize
  74. //
  75. this.comboFontSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  76. this.comboFontSize.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  77. this.comboFontSize.Location = new System.Drawing.Point(67, 31);
  78. this.comboFontSize.Maximum = new decimal(new int[] {
  79. 9999,
  80. 0,
  81. 0,
  82. 0});
  83. this.comboFontSize.Minimum = new decimal(new int[] {
  84. 1,
  85. 0,
  86. 0,
  87. 0});
  88. this.comboFontSize.Name = "comboFontSize";
  89. this.comboFontSize.Size = new System.Drawing.Size(70, 26);
  90. this.comboFontSize.TabIndex = 12;
  91. this.comboFontSize.Value = new decimal(new int[] {
  92. 10,
  93. 0,
  94. 0,
  95. 0});
  96. //
  97. // label2
  98. //
  99. this.label2.AutoSize = true;
  100. this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  101. this.label2.Location = new System.Drawing.Point(152, 37);
  102. this.label2.Name = "label2";
  103. this.label2.Size = new System.Drawing.Size(0, 12);
  104. this.label2.TabIndex = 8;
  105. //
  106. // label1
  107. //
  108. this.label1.AutoSize = true;
  109. this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  110. this.label1.Location = new System.Drawing.Point(22, 37);
  111. this.label1.Name = "label1";
  112. this.label1.Size = new System.Drawing.Size(0, 12);
  113. this.label1.TabIndex = 7;
  114. //
  115. // panelColour
  116. //
  117. this.panelColour.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  118. this.panelColour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  119. this.panelColour.Location = new System.Drawing.Point(223, 31);
  120. this.panelColour.Name = "panelColour";
  121. this.panelColour.Size = new System.Drawing.Size(70, 24);
  122. this.panelColour.TabIndex = 6;
  123. this.panelColour.Click += new System.EventHandler(this.panelColour_Click);
  124. //
  125. // groupBox1
  126. //
  127. this.groupBox1.Controls.Add(this.btnClose);
  128. this.groupBox1.Controls.Add(this.btnPreservation);
  129. this.groupBox1.Location = new System.Drawing.Point(4, 8);
  130. this.groupBox1.Name = "groupBox1";
  131. this.groupBox1.Size = new System.Drawing.Size(597, 64);
  132. this.groupBox1.TabIndex = 3;
  133. this.groupBox1.TabStop = false;
  134. //
  135. // btnClose
  136. //
  137. this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  138. | System.Windows.Forms.AnchorStyles.Right)));
  139. this.btnClose.Location = new System.Drawing.Point(399, 21);
  140. this.btnClose.Name = "btnClose";
  141. this.btnClose.Size = new System.Drawing.Size(84, 30);
  142. this.btnClose.TabIndex = 4;
  143. this.btnClose.UseVisualStyleBackColor = true;
  144. this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
  145. //
  146. // btnPreservation
  147. //
  148. this.btnPreservation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  149. | System.Windows.Forms.AnchorStyles.Right)));
  150. this.btnPreservation.Location = new System.Drawing.Point(500, 21);
  151. this.btnPreservation.Name = "btnPreservation";
  152. this.btnPreservation.Size = new System.Drawing.Size(84, 30);
  153. this.btnPreservation.TabIndex = 3;
  154. this.btnPreservation.UseVisualStyleBackColor = true;
  155. this.btnPreservation.Click += new System.EventHandler(this.btnPreservation_Click);
  156. //
  157. // DisplaySetting
  158. //
  159. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  160. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  161. this.ClientSize = new System.Drawing.Size(604, 214);
  162. this.Controls.Add(this.groupBox2);
  163. this.Controls.Add(this.groupBox1);
  164. this.MaximizeBox = false;
  165. this.MinimizeBox = false;
  166. this.Name = "DisplaySetting";
  167. this.groupBox2.ResumeLayout(false);
  168. this.groupBox2.PerformLayout();
  169. ((System.ComponentModel.ISupportInitialize)(this.comboFontSize)).EndInit();
  170. this.groupBox1.ResumeLayout(false);
  171. this.ResumeLayout(false);
  172. }
  173. #endregion
  174. private System.Windows.Forms.GroupBox groupBox2;
  175. private System.Windows.Forms.Label label2;
  176. private System.Windows.Forms.Label label1;
  177. private System.Windows.Forms.Panel panelColour;
  178. private System.Windows.Forms.GroupBox groupBox1;
  179. private System.Windows.Forms.Button btnClose;
  180. private System.Windows.Forms.Button btnPreservation;
  181. private System.Windows.Forms.NumericUpDown comboFontSize;
  182. #endregion
  183. /// <summary>
  184. /// 调色板
  185. /// </summary>
  186. PaintDotNet.ColorsForm colorsForm;
  187. public DisplaySetting()
  188. {
  189. InitializeComponent();
  190. InitializeLanguageText();
  191. InitOtherTools();
  192. }
  193. private void InitOtherTools()
  194. {
  195. //
  196. //调色板
  197. //
  198. this.colorsForm = new ColorsForm();
  199. this.colorsForm.StartPosition = FormStartPosition.CenterScreen;
  200. this.colorsForm.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  201. if (SpheroidizationGraphiteSize.spheroidizationGraphiteSize.colourFont != null)
  202. {
  203. this.comboFontSize.Text = SpheroidizationGraphiteSize.spheroidizationGraphiteSize.colourFont.Keys.First();
  204. this.panelColour.BackColor = SpheroidizationGraphiteSize.spheroidizationGraphiteSize.colourFont.Values.First();
  205. }
  206. else
  207. {
  208. this.comboFontSize.Text = 10.ToString();
  209. this.panelColour.BackColor = Color.Black;
  210. }
  211. }
  212. /// <summary>
  213. /// 调色板回调函数
  214. /// </summary>
  215. /// <param name="sender"></param>
  216. /// <param name="ce"></param>
  217. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  218. {
  219. }
  220. private void panelColour_Click(object sender, EventArgs e)
  221. {
  222. this.colorsForm.UserPrimaryColor = ColorBgra.FromColor(this.panelColour.BackColor);
  223. this.colorsForm.setSaveBtn_Click(new System.EventHandler(this.colorsFormChanged));
  224. this.colorsForm.ShowDialog();
  225. }
  226. private void colorsFormChanged(object sender, EventArgs e)
  227. {
  228. this.panelColour.BackColor = this.colorsForm.UserPrimaryColor.ToColor();
  229. this.colorsForm.Close();
  230. }
  231. private void btnClose_Click(object sender, EventArgs e)
  232. {
  233. this.Close();
  234. }
  235. private void btnPreservation_Click(object sender, EventArgs e)
  236. {
  237. SpheroidizationGraphiteSize.spheroidizationGraphiteSize.colourFont.Clear();
  238. SpheroidizationGraphiteSize.spheroidizationGraphiteSize.colourFont.Add(this.comboFontSize.Text, this.panelColour.BackColor);
  239. if (SpheroidizationGraphiteSize.spheroidizationGraphiteSize.checkBox5.Checked)
  240. {
  241. SpheroidizationGraphiteSize.spheroidizationGraphiteSize.AddPictureBoxEvent();
  242. SpheroidizationGraphiteSize.spheroidizationGraphiteSize.documentWorkspace.Refresh();
  243. }
  244. this.Close();
  245. }
  246. }
  247. }