ChangeParameter.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. using System;
  2. using System.Collections;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. namespace PaintDotNet.DedicatedAnalysis.menuGrayiron
  6. {
  7. public partial class ChangeParameter : PdnBaseForm
  8. {
  9. /// <summary>
  10. /// 调色板
  11. /// </summary>
  12. PaintDotNet.ColorsForm colorsForm1;
  13. /// <summary>
  14. /// 下拉框默认值
  15. /// </summary>
  16. private static String num= "14" ;
  17. /// <summary>
  18. /// 颜色默认值
  19. /// </summary>
  20. private static Color color =Color.Black ;
  21. private NumericUpDown numericUpDown1;
  22. private ToolTip toolTip1;
  23. /// <summary>
  24. /// Required designer variable.
  25. /// </summary>
  26. private System.ComponentModel.IContainer components = null;
  27. public ChangeParameter()
  28. {
  29. InitializeComponent();
  30. InitializeLanguageText();
  31. }
  32. #region Windows Form Designer generated code
  33. private void InitializeLanguageText()
  34. {
  35. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  36. this.button2.Text = PdnResources.GetString("CommonAction.Save");
  37. this.button1.Text = PdnResources.GetString("Menu.File.Close.Text");
  38. this.groupBox2.Text = PdnResources.GetString("Menu.Colorsetting.text");
  39. this.label2.Text = PdnResources.GetString("Menu.color.text") + ":";
  40. this.label1.Text = PdnResources.GetString("Menu.Fontsize.text") + ":";
  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.groupBox1 = new System.Windows.Forms.GroupBox();
  51. this.button2 = new System.Windows.Forms.Button();
  52. this.button1 = new System.Windows.Forms.Button();
  53. this.groupBox2 = new System.Windows.Forms.GroupBox();
  54. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  55. this.panel1 = new System.Windows.Forms.Panel();
  56. this.label2 = new System.Windows.Forms.Label();
  57. this.label1 = new System.Windows.Forms.Label();
  58. this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
  59. this.groupBox1.SuspendLayout();
  60. this.groupBox2.SuspendLayout();
  61. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  62. this.SuspendLayout();
  63. //
  64. // groupBox1
  65. //
  66. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  67. | System.Windows.Forms.AnchorStyles.Right)));
  68. this.groupBox1.Controls.Add(this.button2);
  69. this.groupBox1.Controls.Add(this.button1);
  70. this.groupBox1.Location = new System.Drawing.Point(12, 12);
  71. this.groupBox1.Name = "groupBox1";
  72. this.groupBox1.Size = new System.Drawing.Size(486, 60);
  73. this.groupBox1.TabIndex = 1;
  74. this.groupBox1.TabStop = false;
  75. //
  76. // button2
  77. //
  78. this.button2.AutoEllipsis = true;
  79. this.button2.Location = new System.Drawing.Point(390, 15);
  80. this.button2.Name = "button2";
  81. this.button2.Size = new System.Drawing.Size(90, 30);
  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.AutoEllipsis = true;
  89. this.button1.Location = new System.Drawing.Point(294, 15);
  90. this.button1.Name = "button1";
  91. this.button1.Size = new System.Drawing.Size(90, 30);
  92. this.button1.TabIndex = 0;
  93. this.button1.UseVisualStyleBackColor = true;
  94. this.button1.Click += new System.EventHandler(this.button1_Click);
  95. //
  96. // groupBox2
  97. //
  98. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  99. | System.Windows.Forms.AnchorStyles.Left)
  100. | System.Windows.Forms.AnchorStyles.Right)));
  101. this.groupBox2.Controls.Add(this.numericUpDown1);
  102. this.groupBox2.Controls.Add(this.panel1);
  103. this.groupBox2.Controls.Add(this.label2);
  104. this.groupBox2.Controls.Add(this.label1);
  105. this.groupBox2.Location = new System.Drawing.Point(12, 78);
  106. this.groupBox2.Name = "groupBox2";
  107. this.groupBox2.Size = new System.Drawing.Size(486, 137);
  108. this.groupBox2.TabIndex = 2;
  109. this.groupBox2.TabStop = false;
  110. //
  111. // numericUpDown1
  112. //
  113. this.numericUpDown1.Location = new System.Drawing.Point(55, 46);
  114. this.numericUpDown1.Maximum = new decimal(new int[] {
  115. 49000,
  116. 0,
  117. 0,
  118. 0});
  119. this.numericUpDown1.Minimum = new decimal(new int[] {
  120. 1,
  121. 0,
  122. 0,
  123. 0});
  124. this.numericUpDown1.Name = "numericUpDown1";
  125. this.numericUpDown1.Size = new System.Drawing.Size(120, 21);
  126. this.numericUpDown1.TabIndex = 4;
  127. this.numericUpDown1.Value = new decimal(new int[] {
  128. 12,
  129. 0,
  130. 0,
  131. 0});
  132. //
  133. // panel1
  134. //
  135. this.panel1.BackColor = System.Drawing.Color.Black;
  136. this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  137. this.panel1.ForeColor = System.Drawing.Color.Black;
  138. this.panel1.Location = new System.Drawing.Point(252, 46);
  139. this.panel1.Name = "panel1";
  140. this.panel1.Size = new System.Drawing.Size(121, 20);
  141. this.panel1.TabIndex = 3;
  142. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  143. //
  144. // label2
  145. //
  146. this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  147. this.label2.Location = new System.Drawing.Point(198, 49);
  148. this.label2.Name = "label2";
  149. this.label2.Size = new System.Drawing.Size(45, 14);
  150. this.label2.TabIndex = 1;
  151. //
  152. // label1
  153. //
  154. this.label1.AutoEllipsis = true;
  155. this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  156. this.label1.Location = new System.Drawing.Point(7, 49);
  157. this.label1.Name = "label1";
  158. this.label1.Size = new System.Drawing.Size(45, 14);
  159. this.label1.TabIndex = 0;
  160. //
  161. // ChangeParameter
  162. //
  163. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  164. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  165. this.AutoSize = true;
  166. this.BackColor = System.Drawing.SystemColors.Control;
  167. this.ClientSize = new System.Drawing.Size(502, 227);
  168. this.Controls.Add(this.groupBox2);
  169. this.Controls.Add(this.groupBox1);
  170. this.MaximizeBox = false;
  171. this.MinimizeBox = false;
  172. this.Name = "ChangeParameter";
  173. this.Load += new System.EventHandler(this.ChangeParameter_Load);
  174. this.Controls.SetChildIndex(this.groupBox1, 0);
  175. this.Controls.SetChildIndex(this.groupBox2, 0);
  176. this.groupBox1.ResumeLayout(false);
  177. this.groupBox2.ResumeLayout(false);
  178. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  179. this.ResumeLayout(false);
  180. }
  181. #endregion
  182. private System.Windows.Forms.GroupBox groupBox1;
  183. private System.Windows.Forms.Button button2;
  184. private System.Windows.Forms.Button button1;
  185. private System.Windows.Forms.GroupBox groupBox2;
  186. private System.Windows.Forms.Label label2;
  187. private System.Windows.Forms.Label label1;
  188. private System.Windows.Forms.Panel panel1;
  189. private void panel1_Click(object sender, System.EventArgs e)
  190. {
  191. this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  192. this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
  193. this.colorsForm1.ShowDialog();
  194. }
  195. private void colorsForm1Changed(object sender, EventArgs e)
  196. {
  197. this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
  198. this.colorsForm1.Close();
  199. }
  200. private void ChangeParameter_Load(object sender, EventArgs e)
  201. {
  202. InitOtherTools();
  203. changeSize();
  204. }
  205. //<summary>
  206. //初始化其他控件
  207. //</summary>
  208. private void InitOtherTools()
  209. {
  210. //
  211. //调色板
  212. //
  213. this.colorsForm1 = new ColorsForm();
  214. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  215. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  216. }
  217. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  218. {
  219. }
  220. private void button1_Click(object sender, EventArgs e)
  221. {
  222. this.Close();
  223. }
  224. private void button2_Click(object sender, EventArgs e)
  225. {
  226. GrayironDialog.fontColor = panel1.BackColor;
  227. GrayironDialog.fontSize= numericUpDown1.Text;
  228. this.Close();
  229. }
  230. private void changeSize()
  231. {
  232. if (GrayironDialog.fontSize !=null && GrayironDialog.fontColor!=null)
  233. {
  234. this.numericUpDown1.Text= GrayironDialog.fontSize;
  235. this.panel1.BackColor= GrayironDialog.fontColor;
  236. }
  237. }
  238. }
  239. }