DisplaySetting.cs 11 KB

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