DisplaySetting.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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 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.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.label2.Text = PdnResources.GetString("Menu.fontcolor.text");
  39. this.label1.Text = PdnResources.GetString("Menu.Fontsize.text");
  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.groupBox1 = new System.Windows.Forms.GroupBox();
  49. this.btnClose = new System.Windows.Forms.Button();
  50. this.btnPreservation = new System.Windows.Forms.Button();
  51. this.groupBox2 = new System.Windows.Forms.GroupBox();
  52. this.comboFontSize = new System.Windows.Forms.NumericUpDown();
  53. this.label2 = new System.Windows.Forms.Label();
  54. this.label1 = new System.Windows.Forms.Label();
  55. this.panelColour = new System.Windows.Forms.Panel();
  56. this.groupBox1.SuspendLayout();
  57. this.groupBox2.SuspendLayout();
  58. ((System.ComponentModel.ISupportInitialize)(this.comboFontSize)).BeginInit();
  59. this.SuspendLayout();
  60. //
  61. // groupBox1
  62. //
  63. this.groupBox1.Controls.Add(this.btnClose);
  64. this.groupBox1.Controls.Add(this.btnPreservation);
  65. this.groupBox1.Location = new System.Drawing.Point(3, 3);
  66. this.groupBox1.Name = "groupBox1";
  67. this.groupBox1.Size = new System.Drawing.Size(597, 64);
  68. this.groupBox1.TabIndex = 1;
  69. this.groupBox1.TabStop = false;
  70. //
  71. // btnClose
  72. //
  73. this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  74. | System.Windows.Forms.AnchorStyles.Right)));
  75. this.btnClose.Location = new System.Drawing.Point(399, 21);
  76. this.btnClose.Name = "btnClose";
  77. this.btnClose.Size = new System.Drawing.Size(84, 30);
  78. this.btnClose.TabIndex = 4;
  79. this.btnClose.UseVisualStyleBackColor = true;
  80. this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
  81. //
  82. // btnPreservation
  83. //
  84. this.btnPreservation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  85. | System.Windows.Forms.AnchorStyles.Right)));
  86. this.btnPreservation.Location = new System.Drawing.Point(500, 21);
  87. this.btnPreservation.Name = "btnPreservation";
  88. this.btnPreservation.Size = new System.Drawing.Size(84, 30);
  89. this.btnPreservation.TabIndex = 3;
  90. this.btnPreservation.UseVisualStyleBackColor = true;
  91. this.btnPreservation.Click += new System.EventHandler(this.btnPreservation_Click);
  92. //
  93. // groupBox2
  94. //
  95. this.groupBox2.Controls.Add(this.comboFontSize);
  96. this.groupBox2.Controls.Add(this.label2);
  97. this.groupBox2.Controls.Add(this.label1);
  98. this.groupBox2.Controls.Add(this.panelColour);
  99. this.groupBox2.Location = new System.Drawing.Point(3, 72);
  100. this.groupBox2.Name = "groupBox2";
  101. this.groupBox2.Size = new System.Drawing.Size(597, 130);
  102. this.groupBox2.TabIndex = 2;
  103. this.groupBox2.TabStop = false;
  104. //
  105. // comboFontSize
  106. //
  107. this.comboFontSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  108. this.comboFontSize.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  109. this.comboFontSize.Location = new System.Drawing.Point(66, 31);
  110. this.comboFontSize.Maximum = new decimal(new int[] {
  111. 9999,
  112. 0,
  113. 0,
  114. 0});
  115. this.comboFontSize.Minimum = new decimal(new int[] {
  116. 1,
  117. 0,
  118. 0,
  119. 0});
  120. this.comboFontSize.Name = "comboFontSize";
  121. this.comboFontSize.Size = new System.Drawing.Size(70, 26);
  122. this.comboFontSize.TabIndex = 11;
  123. this.comboFontSize.Value = new decimal(new int[] {
  124. 10,
  125. 0,
  126. 0,
  127. 0});
  128. //
  129. // label2
  130. //
  131. this.label2.AutoSize = true;
  132. this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  133. this.label2.Location = new System.Drawing.Point(152, 37);
  134. this.label2.Name = "label2";
  135. this.label2.Size = new System.Drawing.Size(0, 12);
  136. this.label2.TabIndex = 8;
  137. //
  138. // label1
  139. //
  140. this.label1.AutoSize = true;
  141. this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  142. this.label1.Location = new System.Drawing.Point(22, 37);
  143. this.label1.Name = "label1";
  144. this.label1.Size = new System.Drawing.Size(0, 12);
  145. this.label1.TabIndex = 7;
  146. //
  147. // panelColour
  148. //
  149. this.panelColour.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  150. this.panelColour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  151. this.panelColour.Location = new System.Drawing.Point(223, 30);
  152. this.panelColour.Name = "panelColour";
  153. this.panelColour.Size = new System.Drawing.Size(70, 27);
  154. this.panelColour.TabIndex = 6;
  155. this.panelColour.Click += new System.EventHandler(this.panelColour_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.groupBox1.ResumeLayout(false);
  168. this.groupBox2.ResumeLayout(false);
  169. this.groupBox2.PerformLayout();
  170. ((System.ComponentModel.ISupportInitialize)(this.comboFontSize)).EndInit();
  171. this.ResumeLayout(false);
  172. }
  173. #endregion
  174. private System.Windows.Forms.GroupBox groupBox1;
  175. private System.Windows.Forms.Button btnClose;
  176. private System.Windows.Forms.Button btnPreservation;
  177. private System.Windows.Forms.GroupBox groupBox2;
  178. private System.Windows.Forms.Panel panelColour;
  179. private System.Windows.Forms.Label label2;
  180. private System.Windows.Forms.Label label1;
  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 (SpheroidizationLevelDialog.spheroidizationLevelDialog.colourFont != null)
  202. {
  203. this.comboFontSize.Text = SpheroidizationLevelDialog.spheroidizationLevelDialog.colourFont.Keys.First();
  204. this.panelColour.BackColor = SpheroidizationLevelDialog.spheroidizationLevelDialog.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 btnPreservation_Click(object sender, EventArgs e)
  232. {
  233. SpheroidizationLevelDialog.spheroidizationLevelDialog.colourFont.Clear();
  234. SpheroidizationLevelDialog.spheroidizationLevelDialog.colourFont.Add(this.comboFontSize.Text, this.panelColour.BackColor);
  235. if (SpheroidizationLevelDialog.spheroidizationLevelDialog.checkBox5.Checked)
  236. {
  237. SpheroidizationLevelDialog.spheroidizationLevelDialog.AddPictureBoxEvent();
  238. SpheroidizationLevelDialog.spheroidizationLevelDialog.documentWorkspace.Refresh();
  239. }
  240. this.Close();
  241. }
  242. private void btnClose_Click(object sender, EventArgs e)
  243. {
  244. this.Close();
  245. }
  246. }
  247. }