VermiculateCastIronSetFontDialog.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. using System;
  2. using System.Collections;
  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 PaintDotNet.DedicatedAnalysis.VermiculateCastIron.JBT3829_1999
  12. {
  13. /// <summary>
  14. /// 字体设置
  15. /// </summary>
  16. internal class VermiculateCastIronSetFontDialog : PdnBaseForm
  17. {
  18. private GroupBox groupBox1;
  19. private Button button2;
  20. private GroupBox groupBox2;
  21. private Label label1;
  22. private ComboBox comboBox2;
  23. private ComboBox comboBox1;
  24. private Label label2;
  25. private Button button1;
  26. private VermiculateCastIronJBT3829Classification mainForm;
  27. private Label label3;
  28. private Panel panel1;
  29. private int[] fontSizes = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
  30. PaintDotNet.ColorsForm colorsForm1;
  31. public VermiculateCastIronSetFontDialog(VermiculateCastIronJBT3829Classification 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.label1.Text = PdnResources.GetString("Menu.Font.text") + ":";
  43. }
  44. private void InitializeComponent()
  45. {
  46. this.groupBox1 = new System.Windows.Forms.GroupBox();
  47. this.button2 = new System.Windows.Forms.Button();
  48. this.button1 = new System.Windows.Forms.Button();
  49. this.groupBox2 = new System.Windows.Forms.GroupBox();
  50. this.panel1 = new System.Windows.Forms.Panel();
  51. this.label3 = new System.Windows.Forms.Label();
  52. this.comboBox2 = new System.Windows.Forms.ComboBox();
  53. this.comboBox1 = new System.Windows.Forms.ComboBox();
  54. this.label2 = new System.Windows.Forms.Label();
  55. this.label1 = new System.Windows.Forms.Label();
  56. this.groupBox1.SuspendLayout();
  57. this.groupBox2.SuspendLayout();
  58. this.SuspendLayout();
  59. //
  60. // groupBox1
  61. //
  62. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  63. | System.Windows.Forms.AnchorStyles.Right)));
  64. this.groupBox1.Controls.Add(this.button2);
  65. this.groupBox1.Controls.Add(this.button1);
  66. this.groupBox1.Location = new System.Drawing.Point(13, 12);
  67. this.groupBox1.Name = "groupBox1";
  68. this.groupBox1.Size = new System.Drawing.Size(283, 49);
  69. this.groupBox1.TabIndex = 1;
  70. this.groupBox1.TabStop = false;
  71. //
  72. // button2
  73. //
  74. this.button2.Location = new System.Drawing.Point(211, 17);
  75. this.button2.Name = "button2";
  76. this.button2.Size = new System.Drawing.Size(58, 22);
  77. this.button2.TabIndex = 1;
  78. this.button2.UseVisualStyleBackColor = true;
  79. this.button2.Click += new System.EventHandler(this.button2_Click);
  80. //
  81. // button1
  82. //
  83. this.button1.Location = new System.Drawing.Point(136, 17);
  84. this.button1.Name = "button1";
  85. this.button1.Size = new System.Drawing.Size(58, 22);
  86. this.button1.TabIndex = 0;
  87. this.button1.Text = "确认";
  88. this.button1.UseVisualStyleBackColor = true;
  89. this.button1.Click += new System.EventHandler(this.button1_Click);
  90. //
  91. // groupBox2
  92. //
  93. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  94. | System.Windows.Forms.AnchorStyles.Left)
  95. | System.Windows.Forms.AnchorStyles.Right)));
  96. this.groupBox2.Controls.Add(this.panel1);
  97. this.groupBox2.Controls.Add(this.label3);
  98. this.groupBox2.Controls.Add(this.comboBox2);
  99. this.groupBox2.Controls.Add(this.comboBox1);
  100. this.groupBox2.Controls.Add(this.label2);
  101. this.groupBox2.Controls.Add(this.label1);
  102. this.groupBox2.Location = new System.Drawing.Point(13, 68);
  103. this.groupBox2.Name = "groupBox2";
  104. this.groupBox2.Size = new System.Drawing.Size(283, 103);
  105. this.groupBox2.TabIndex = 2;
  106. this.groupBox2.TabStop = false;
  107. this.groupBox2.Text = "字体设置";
  108. //
  109. // panel1
  110. //
  111. this.panel1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  112. this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  113. this.panel1.Location = new System.Drawing.Point(120, 76);
  114. this.panel1.Name = "panel1";
  115. this.panel1.Size = new System.Drawing.Size(111, 20);
  116. this.panel1.TabIndex = 5;
  117. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  118. //
  119. // label3
  120. //
  121. this.label3.AutoSize = true;
  122. this.label3.Location = new System.Drawing.Point(51, 79);
  123. this.label3.Name = "label3";
  124. this.label3.Size = new System.Drawing.Size(65, 12);
  125. this.label3.TabIndex = 4;
  126. this.label3.Text = "字体颜色:";
  127. //
  128. // comboBox2
  129. //
  130. this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  131. this.comboBox2.FormattingEnabled = true;
  132. this.comboBox2.Location = new System.Drawing.Point(120, 46);
  133. this.comboBox2.Name = "comboBox2";
  134. this.comboBox2.Size = new System.Drawing.Size(111, 20);
  135. this.comboBox2.TabIndex = 3;
  136. //
  137. // comboBox1
  138. //
  139. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  140. this.comboBox1.FormattingEnabled = true;
  141. this.comboBox1.Location = new System.Drawing.Point(120, 16);
  142. this.comboBox1.Name = "comboBox1";
  143. this.comboBox1.Size = new System.Drawing.Size(111, 20);
  144. this.comboBox1.TabIndex = 2;
  145. //
  146. // label2
  147. //
  148. this.label2.AutoSize = true;
  149. this.label2.Location = new System.Drawing.Point(51, 49);
  150. this.label2.Name = "label2";
  151. this.label2.Size = new System.Drawing.Size(41, 12);
  152. this.label2.TabIndex = 1;
  153. this.label2.Text = "字号:";
  154. //
  155. // label1
  156. //
  157. this.label1.AutoSize = true;
  158. this.label1.Location = new System.Drawing.Point(51, 19);
  159. this.label1.Name = "label1";
  160. this.label1.Size = new System.Drawing.Size(41, 12);
  161. this.label1.TabIndex = 0;
  162. //
  163. // VermiculateCastIronSetFontDialog
  164. //
  165. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  166. this.ClientSize = new System.Drawing.Size(308, 184);
  167. this.Controls.Add(this.groupBox2);
  168. this.Controls.Add(this.groupBox1);
  169. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  170. this.MaximizeBox = false;
  171. this.MinimizeBox = false;
  172. this.Name = "VermiculateCastIronSetFontDialog";
  173. this.Text = "字体设置";
  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. this.groupBox2.PerformLayout();
  179. this.ResumeLayout(false);
  180. }
  181. private void InitializeOthers()
  182. {
  183. ArrayList fontsItems = new ArrayList();
  184. System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
  185. foreach (FontFamily fontFamily in fonts.Families)
  186. {
  187. fontsItems.Add(fontFamily.Name);
  188. }
  189. this.comboBox1.DataSource = fontsItems;
  190. this.comboBox1.Text = this.mainForm.fontStyle;
  191. this.comboBox2.DataSource = fontSizes;
  192. this.comboBox2.Text = this.mainForm.fontSize + "";
  193. this.colorsForm1 = new ColorsForm();
  194. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  195. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  196. this.panel1.BackColor = this.mainForm.fontColor;
  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.SetVermiculateCastIronFont(this.comboBox1.SelectedItem.ToString(), float.Parse(this.comboBox2.SelectedItem.ToString()), this.panel1.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. }
  237. }