LabelRulerStyleDialog.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. using PaintDotNet.Annotation;
  2. using PaintDotNet.Annotation.Enum;
  3. using PaintDotNet.Annotation.Label;
  4. using PaintDotNet.Base.CommTool;
  5. using PaintDotNet.Base.SettingModel;
  6. using System;
  7. using System.Collections;
  8. using System.Drawing;
  9. using System.Windows.Forms;
  10. namespace PaintDotNet.ImageLabel
  11. {
  12. internal class LabelRulerStyleDialog : PdnBaseForm
  13. {
  14. private Button button1;
  15. private Button button2;
  16. private GroupBox groupBox2;
  17. private Label label1;
  18. private Label label4;
  19. private Label label3;
  20. private Label label2;
  21. private Label label5;
  22. private Label label8;
  23. private Label label7;
  24. private Label label6;
  25. private Label label12;
  26. private Label label11;
  27. private Label label10;
  28. private Label label9;
  29. private GroupBox groupBox3;
  30. private Label label13;
  31. private NumericUpDown numericUpDown1;
  32. private Label label14;
  33. private NumericUpDown numericUpDown3;
  34. private ComboBox comboBox1;
  35. private Panel panel1;
  36. private ComboBox comboBox2;
  37. private Panel panel2;
  38. private Panel panel3;
  39. private NumericUpDown numericUpDown4;
  40. private NumericUpDown numericUpDown6;
  41. private NumericUpDown numericUpDown5;
  42. private Label label18;
  43. private Label label17;
  44. private Panel panel4;
  45. private Panel panel5;
  46. private NumericUpDown numericUpDown7;
  47. private Label label19;
  48. private Panel panel6;
  49. private NumericUpDown numericUpDown8;
  50. private GroupBox groupBox1;
  51. PaintDotNet.ColorsForm colorsFormFont;
  52. PaintDotNet.ColorsForm colorsFormLine;
  53. PaintDotNet.ColorsForm colorsFormBackground;
  54. PaintDotNet.ColorsForm colorsFormBorder;
  55. private AppWorkspace appWorkspace;
  56. private DrawObject drawObject;
  57. private ParentStyleModel parentStyleModel;
  58. private RulerModel rulerModel;
  59. private ComboBox textBold;
  60. private Label label21;
  61. /// <summary>
  62. /// 字体位置下拉
  63. /// </summary>
  64. private string[] textPosition = new string[] { PdnResources.GetString("Menu.Set.Rulersettings.Left.text"), PdnResources.GetString("Menu.nthemiddle.Text"), PdnResources.GetString("Menu.Set.Rulersettings.Right.text") };
  65. public LabelRulerStyleDialog(AppWorkspace appWorkspace, DrawObject drawObject)
  66. {
  67. this.appWorkspace = appWorkspace;
  68. this.drawObject = drawObject;
  69. string rulerXmlNotes = XmlSerializeHelper.XmlSerialize<RulerModel>((RulerModel)this.drawObject.GetStyle());
  70. this.parentStyleModel = DrawRulerHelper.DeserializeXML<RulerModel>(rulerXmlNotes);
  71. InitializeComponent();
  72. InitializeLanguageText();
  73. InitializeData();
  74. InitializeRulerModel();
  75. }
  76. private void InitializeLanguageText()
  77. {
  78. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  79. this.button2.Text = PdnResources.GetString("Menu.cancel.text");
  80. this.button1.Text = PdnResources.GetString("Menu.application.text");
  81. this.groupBox2.Text = PdnResources.GetString("Menu.Set.typesettings.Stylesetting.text");
  82. this.label12.Text = PdnResources.GetString("Menu.Set.Rulersettings.Borderlinewidth.text") + ":";
  83. this.label11.Text = PdnResources.GetString("Menu.Set.Rulersettings.Borderlinecolor.text") + ":";
  84. this.label10.Text = PdnResources.GetString("Menu.Backgroundsize.text") + ":";
  85. this.label9.Text = PdnResources.GetString("Menu.backgroundcolor.text") + ":";
  86. this.label8.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textheight.text") + ":";
  87. this.label7.Text = PdnResources.GetString("Menu.Set.Rulersettings.lengthofperpendicular.text") + ":";
  88. this.label6.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linewidth.text") + ":";
  89. this.label5.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linecolor.text") + ":";
  90. this.label4.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textposition.text") + ":";
  91. this.label3.Text = PdnResources.GetString("Menu.Textcolor.text") + ":";
  92. this.label2.Text = PdnResources.GetString("Menu.Textfont.text") + ":";
  93. this.label1.Text = PdnResources.GetString("Menu.Set.Rulersettings.Fontsize.text") + ":";
  94. this.groupBox3.Text = PdnResources.GetString("Menu.LabelAction.DrawAutoRuler.Text");
  95. this.label14.Text = PdnResources.GetString("Menu.Set.Rulersettings.Dividebymagnification.text");
  96. this.label13.Text = PdnResources.GetString("Menu.Calculationofcalelength.Text") + ":";
  97. this.Text = PdnResources.GetString("Menu.Setting.RuleSetting.Text");
  98. }
  99. private void InitializeComponent()
  100. {
  101. this.groupBox1 = new System.Windows.Forms.GroupBox();
  102. this.button2 = new System.Windows.Forms.Button();
  103. this.button1 = new System.Windows.Forms.Button();
  104. this.groupBox2 = new System.Windows.Forms.GroupBox();
  105. this.numericUpDown8 = new System.Windows.Forms.NumericUpDown();
  106. this.panel6 = new System.Windows.Forms.Panel();
  107. this.label19 = new System.Windows.Forms.Label();
  108. this.numericUpDown7 = new System.Windows.Forms.NumericUpDown();
  109. this.panel5 = new System.Windows.Forms.Panel();
  110. this.panel4 = new System.Windows.Forms.Panel();
  111. this.label18 = new System.Windows.Forms.Label();
  112. this.label17 = new System.Windows.Forms.Label();
  113. this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
  114. this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
  115. this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
  116. this.panel3 = new System.Windows.Forms.Panel();
  117. this.panel2 = new System.Windows.Forms.Panel();
  118. this.comboBox2 = new System.Windows.Forms.ComboBox();
  119. this.panel1 = new System.Windows.Forms.Panel();
  120. this.comboBox1 = new System.Windows.Forms.ComboBox();
  121. this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
  122. this.label12 = new System.Windows.Forms.Label();
  123. this.label11 = new System.Windows.Forms.Label();
  124. this.label10 = new System.Windows.Forms.Label();
  125. this.label9 = new System.Windows.Forms.Label();
  126. this.label8 = new System.Windows.Forms.Label();
  127. this.label7 = new System.Windows.Forms.Label();
  128. this.label6 = new System.Windows.Forms.Label();
  129. this.label5 = new System.Windows.Forms.Label();
  130. this.label4 = new System.Windows.Forms.Label();
  131. this.label3 = new System.Windows.Forms.Label();
  132. this.label2 = new System.Windows.Forms.Label();
  133. this.label1 = new System.Windows.Forms.Label();
  134. this.groupBox3 = new System.Windows.Forms.GroupBox();
  135. this.label14 = new System.Windows.Forms.Label();
  136. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  137. this.label13 = new System.Windows.Forms.Label();
  138. this.textBold = new System.Windows.Forms.ComboBox();
  139. this.label21 = new System.Windows.Forms.Label();
  140. this.groupBox1.SuspendLayout();
  141. this.groupBox2.SuspendLayout();
  142. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).BeginInit();
  143. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).BeginInit();
  144. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
  145. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
  146. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
  147. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
  148. this.groupBox3.SuspendLayout();
  149. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  150. this.SuspendLayout();
  151. //
  152. // groupBox1
  153. //
  154. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  155. | System.Windows.Forms.AnchorStyles.Right)));
  156. this.groupBox1.Controls.Add(this.button2);
  157. this.groupBox1.Controls.Add(this.button1);
  158. this.groupBox1.Location = new System.Drawing.Point(13, 13);
  159. this.groupBox1.Name = "groupBox1";
  160. this.groupBox1.Size = new System.Drawing.Size(508, 58);
  161. this.groupBox1.TabIndex = 0;
  162. this.groupBox1.TabStop = false;
  163. this.groupBox1.Text = "操作";
  164. //
  165. // button2
  166. //
  167. this.button2.Location = new System.Drawing.Point(420, 21);
  168. this.button2.Name = "button2";
  169. this.button2.Size = new System.Drawing.Size(75, 23);
  170. this.button2.TabIndex = 1;
  171. this.button2.Text = "取消";
  172. this.button2.UseVisualStyleBackColor = true;
  173. this.button2.Click += new System.EventHandler(this.button2_Click);
  174. //
  175. // button1
  176. //
  177. this.button1.Location = new System.Drawing.Point(339, 21);
  178. this.button1.Name = "button1";
  179. this.button1.Size = new System.Drawing.Size(75, 23);
  180. this.button1.TabIndex = 0;
  181. this.button1.Text = "应用";
  182. this.button1.UseVisualStyleBackColor = true;
  183. this.button1.Click += new System.EventHandler(this.button1_Click);
  184. //
  185. // groupBox2
  186. //
  187. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  188. | System.Windows.Forms.AnchorStyles.Right)));
  189. this.groupBox2.Controls.Add(this.textBold);
  190. this.groupBox2.Controls.Add(this.label21);
  191. this.groupBox2.Controls.Add(this.numericUpDown8);
  192. this.groupBox2.Controls.Add(this.panel6);
  193. this.groupBox2.Controls.Add(this.label19);
  194. this.groupBox2.Controls.Add(this.numericUpDown7);
  195. this.groupBox2.Controls.Add(this.panel5);
  196. this.groupBox2.Controls.Add(this.panel4);
  197. this.groupBox2.Controls.Add(this.label18);
  198. this.groupBox2.Controls.Add(this.label17);
  199. this.groupBox2.Controls.Add(this.numericUpDown6);
  200. this.groupBox2.Controls.Add(this.numericUpDown5);
  201. this.groupBox2.Controls.Add(this.numericUpDown4);
  202. this.groupBox2.Controls.Add(this.panel3);
  203. this.groupBox2.Controls.Add(this.panel2);
  204. this.groupBox2.Controls.Add(this.comboBox2);
  205. this.groupBox2.Controls.Add(this.panel1);
  206. this.groupBox2.Controls.Add(this.comboBox1);
  207. this.groupBox2.Controls.Add(this.numericUpDown3);
  208. this.groupBox2.Controls.Add(this.label12);
  209. this.groupBox2.Controls.Add(this.label11);
  210. this.groupBox2.Controls.Add(this.label10);
  211. this.groupBox2.Controls.Add(this.label9);
  212. this.groupBox2.Controls.Add(this.label8);
  213. this.groupBox2.Controls.Add(this.label7);
  214. this.groupBox2.Controls.Add(this.label6);
  215. this.groupBox2.Controls.Add(this.label5);
  216. this.groupBox2.Controls.Add(this.label4);
  217. this.groupBox2.Controls.Add(this.label3);
  218. this.groupBox2.Controls.Add(this.label2);
  219. this.groupBox2.Controls.Add(this.label1);
  220. this.groupBox2.Location = new System.Drawing.Point(13, 78);
  221. this.groupBox2.Name = "groupBox2";
  222. this.groupBox2.Size = new System.Drawing.Size(508, 183);
  223. this.groupBox2.TabIndex = 1;
  224. this.groupBox2.TabStop = false;
  225. this.groupBox2.Text = "样式设置";
  226. //
  227. // numericUpDown8
  228. //
  229. this.numericUpDown8.Location = new System.Drawing.Point(410, 118);
  230. this.numericUpDown8.Name = "numericUpDown8";
  231. this.numericUpDown8.Size = new System.Drawing.Size(72, 21);
  232. this.numericUpDown8.TabIndex = 28;
  233. //
  234. // panel6
  235. //
  236. this.panel6.BackColor = System.Drawing.SystemColors.Window;
  237. this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  238. this.panel6.Location = new System.Drawing.Point(410, 87);
  239. this.panel6.Name = "panel6";
  240. this.panel6.Size = new System.Drawing.Size(72, 21);
  241. this.panel6.TabIndex = 27;
  242. this.panel6.Click += new System.EventHandler(this.panel6_Click);
  243. //
  244. // label19
  245. //
  246. this.label19.AutoSize = true;
  247. this.label19.Location = new System.Drawing.Point(471, 59);
  248. this.label19.Name = "label19";
  249. this.label19.Size = new System.Drawing.Size(11, 12);
  250. this.label19.TabIndex = 26;
  251. this.label19.Text = "%";
  252. //
  253. // numericUpDown7
  254. //
  255. this.numericUpDown7.Location = new System.Drawing.Point(410, 54);
  256. this.numericUpDown7.Name = "numericUpDown7";
  257. this.numericUpDown7.Size = new System.Drawing.Size(55, 21);
  258. this.numericUpDown7.TabIndex = 25;
  259. //
  260. // panel5
  261. //
  262. this.panel5.BackColor = System.Drawing.SystemColors.Window;
  263. this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  264. this.panel5.Location = new System.Drawing.Point(410, 23);
  265. this.panel5.Name = "panel5";
  266. this.panel5.Size = new System.Drawing.Size(72, 21);
  267. this.panel5.TabIndex = 24;
  268. this.panel5.Click += new System.EventHandler(this.panel5_Click);
  269. //
  270. // panel4
  271. //
  272. this.panel4.BackColor = System.Drawing.SystemColors.WindowText;
  273. this.panel4.Location = new System.Drawing.Point(333, 13);
  274. this.panel4.Name = "panel4";
  275. this.panel4.Size = new System.Drawing.Size(1, 155);
  276. this.panel4.TabIndex = 23;
  277. //
  278. // label18
  279. //
  280. this.label18.AutoSize = true;
  281. this.label18.Location = new System.Drawing.Point(303, 123);
  282. this.label18.Name = "label18";
  283. this.label18.Size = new System.Drawing.Size(11, 12);
  284. this.label18.TabIndex = 22;
  285. this.label18.Text = "%";
  286. //
  287. // label17
  288. //
  289. this.label17.AutoSize = true;
  290. this.label17.Location = new System.Drawing.Point(303, 91);
  291. this.label17.Name = "label17";
  292. this.label17.Size = new System.Drawing.Size(11, 12);
  293. this.label17.TabIndex = 21;
  294. this.label17.Text = "%";
  295. //
  296. // numericUpDown6
  297. //
  298. this.numericUpDown6.Location = new System.Drawing.Point(242, 119);
  299. this.numericUpDown6.Name = "numericUpDown6";
  300. this.numericUpDown6.Size = new System.Drawing.Size(55, 21);
  301. this.numericUpDown6.TabIndex = 20;
  302. //
  303. // numericUpDown5
  304. //
  305. this.numericUpDown5.Location = new System.Drawing.Point(242, 87);
  306. this.numericUpDown5.Name = "numericUpDown5";
  307. this.numericUpDown5.Size = new System.Drawing.Size(55, 21);
  308. this.numericUpDown5.TabIndex = 19;
  309. //
  310. // numericUpDown4
  311. //
  312. this.numericUpDown4.Location = new System.Drawing.Point(242, 55);
  313. this.numericUpDown4.Minimum = new decimal(new int[] {
  314. 1,
  315. 0,
  316. 0,
  317. 0});
  318. this.numericUpDown4.Name = "numericUpDown4";
  319. this.numericUpDown4.Size = new System.Drawing.Size(72, 21);
  320. this.numericUpDown4.TabIndex = 18;
  321. this.numericUpDown4.Value = new decimal(new int[] {
  322. 1,
  323. 0,
  324. 0,
  325. 0});
  326. //
  327. // panel3
  328. //
  329. this.panel3.BackColor = System.Drawing.SystemColors.Window;
  330. this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  331. this.panel3.Location = new System.Drawing.Point(242, 23);
  332. this.panel3.Name = "panel3";
  333. this.panel3.Size = new System.Drawing.Size(72, 21);
  334. this.panel3.TabIndex = 17;
  335. this.panel3.Click += new System.EventHandler(this.panel3_Click);
  336. //
  337. // panel2
  338. //
  339. this.panel2.BackColor = System.Drawing.SystemColors.WindowText;
  340. this.panel2.Location = new System.Drawing.Point(166, 13);
  341. this.panel2.Name = "panel2";
  342. this.panel2.Size = new System.Drawing.Size(1, 155);
  343. this.panel2.TabIndex = 16;
  344. //
  345. // comboBox2
  346. //
  347. this.comboBox2.DropDownWidth = 72;
  348. this.comboBox2.FormattingEnabled = true;
  349. this.comboBox2.Location = new System.Drawing.Point(76, 119);
  350. this.comboBox2.Name = "comboBox2";
  351. this.comboBox2.Size = new System.Drawing.Size(72, 20);
  352. this.comboBox2.TabIndex = 15;
  353. //
  354. // panel1
  355. //
  356. this.panel1.BackColor = System.Drawing.SystemColors.Window;
  357. this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  358. this.panel1.Location = new System.Drawing.Point(76, 87);
  359. this.panel1.Name = "panel1";
  360. this.panel1.Size = new System.Drawing.Size(72, 21);
  361. this.panel1.TabIndex = 14;
  362. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  363. //
  364. // comboBox1
  365. //
  366. this.comboBox1.FormattingEnabled = true;
  367. this.comboBox1.Location = new System.Drawing.Point(76, 55);
  368. this.comboBox1.Name = "comboBox1";
  369. this.comboBox1.Size = new System.Drawing.Size(72, 20);
  370. this.comboBox1.TabIndex = 13;
  371. //
  372. // numericUpDown3
  373. //
  374. this.numericUpDown3.Location = new System.Drawing.Point(76, 23);
  375. this.numericUpDown3.Minimum = new decimal(new int[] {
  376. 1,
  377. 0,
  378. 0,
  379. 0});
  380. this.numericUpDown3.Name = "numericUpDown3";
  381. this.numericUpDown3.Size = new System.Drawing.Size(72, 21);
  382. this.numericUpDown3.TabIndex = 12;
  383. this.numericUpDown3.Value = new decimal(new int[] {
  384. 1,
  385. 0,
  386. 0,
  387. 0});
  388. //
  389. // label12
  390. //
  391. this.label12.AutoSize = true;
  392. this.label12.Location = new System.Drawing.Point(349, 123);
  393. this.label12.Name = "label12";
  394. this.label12.Size = new System.Drawing.Size(65, 12);
  395. this.label12.TabIndex = 11;
  396. this.label12.Text = "边框线宽:";
  397. //
  398. // label11
  399. //
  400. this.label11.AutoSize = true;
  401. this.label11.Location = new System.Drawing.Point(349, 91);
  402. this.label11.Name = "label11";
  403. this.label11.Size = new System.Drawing.Size(65, 12);
  404. this.label11.TabIndex = 10;
  405. this.label11.Text = "边框颜色:";
  406. //
  407. // label10
  408. //
  409. this.label10.AutoSize = true;
  410. this.label10.Location = new System.Drawing.Point(349, 59);
  411. this.label10.Name = "label10";
  412. this.label10.Size = new System.Drawing.Size(65, 12);
  413. this.label10.TabIndex = 9;
  414. this.label10.Text = "背景大小:";
  415. //
  416. // label9
  417. //
  418. this.label9.AutoSize = true;
  419. this.label9.Location = new System.Drawing.Point(349, 27);
  420. this.label9.Name = "label9";
  421. this.label9.Size = new System.Drawing.Size(65, 12);
  422. this.label9.TabIndex = 8;
  423. this.label9.Text = "背景颜色:";
  424. //
  425. // label8
  426. //
  427. this.label8.AutoSize = true;
  428. this.label8.Location = new System.Drawing.Point(182, 123);
  429. this.label8.Name = "label8";
  430. this.label8.Size = new System.Drawing.Size(65, 12);
  431. this.label8.TabIndex = 7;
  432. this.label8.Text = "文字高度:";
  433. //
  434. // label7
  435. //
  436. this.label7.AutoSize = true;
  437. this.label7.Location = new System.Drawing.Point(182, 91);
  438. this.label7.Name = "label7";
  439. this.label7.Size = new System.Drawing.Size(65, 12);
  440. this.label7.TabIndex = 6;
  441. this.label7.Text = "垂线长度:";
  442. //
  443. // label6
  444. //
  445. this.label6.AutoSize = true;
  446. this.label6.Location = new System.Drawing.Point(182, 59);
  447. this.label6.Name = "label6";
  448. this.label6.Size = new System.Drawing.Size(65, 12);
  449. this.label6.TabIndex = 5;
  450. this.label6.Text = "线条宽度:";
  451. //
  452. // label5
  453. //
  454. this.label5.AutoSize = true;
  455. this.label5.Location = new System.Drawing.Point(182, 27);
  456. this.label5.Name = "label5";
  457. this.label5.Size = new System.Drawing.Size(65, 12);
  458. this.label5.TabIndex = 4;
  459. this.label5.Text = "线条颜色:";
  460. //
  461. // label4
  462. //
  463. this.label4.AutoSize = true;
  464. this.label4.Location = new System.Drawing.Point(15, 123);
  465. this.label4.Name = "label4";
  466. this.label4.Size = new System.Drawing.Size(65, 12);
  467. this.label4.TabIndex = 3;
  468. this.label4.Text = "文字位置:";
  469. //
  470. // label3
  471. //
  472. this.label3.AutoSize = true;
  473. this.label3.Location = new System.Drawing.Point(15, 91);
  474. this.label3.Name = "label3";
  475. this.label3.Size = new System.Drawing.Size(65, 12);
  476. this.label3.TabIndex = 2;
  477. this.label3.Text = "文字颜色:";
  478. //
  479. // label2
  480. //
  481. this.label2.AutoSize = true;
  482. this.label2.Location = new System.Drawing.Point(15, 59);
  483. this.label2.Name = "label2";
  484. this.label2.Size = new System.Drawing.Size(65, 12);
  485. this.label2.TabIndex = 1;
  486. this.label2.Text = "文字字体:";
  487. //
  488. // label1
  489. //
  490. this.label1.AutoSize = true;
  491. this.label1.Location = new System.Drawing.Point(15, 27);
  492. this.label1.Name = "label1";
  493. this.label1.Size = new System.Drawing.Size(65, 12);
  494. this.label1.TabIndex = 0;
  495. this.label1.Text = "文字字号:";
  496. //
  497. // groupBox3
  498. //
  499. this.groupBox3.Controls.Add(this.label14);
  500. this.groupBox3.Controls.Add(this.numericUpDown1);
  501. this.groupBox3.Controls.Add(this.label13);
  502. this.groupBox3.Location = new System.Drawing.Point(13, 273);
  503. this.groupBox3.Name = "groupBox3";
  504. this.groupBox3.Size = new System.Drawing.Size(508, 61);
  505. this.groupBox3.TabIndex = 2;
  506. this.groupBox3.TabStop = false;
  507. this.groupBox3.Text = "自动标尺";
  508. //
  509. // label14
  510. //
  511. this.label14.AutoSize = true;
  512. this.label14.Location = new System.Drawing.Point(146, 37);
  513. this.label14.Name = "label14";
  514. this.label14.Size = new System.Drawing.Size(77, 12);
  515. this.label14.TabIndex = 2;
  516. this.label14.Text = "除以放大倍数";
  517. //
  518. // numericUpDown1
  519. //
  520. this.numericUpDown1.Location = new System.Drawing.Point(103, 13);
  521. this.numericUpDown1.Maximum = new decimal(new int[] {
  522. 99999999,
  523. 0,
  524. 0,
  525. 0});
  526. this.numericUpDown1.Name = "numericUpDown1";
  527. this.numericUpDown1.Size = new System.Drawing.Size(120, 21);
  528. this.numericUpDown1.TabIndex = 1;
  529. //
  530. // label13
  531. //
  532. this.label13.AutoSize = true;
  533. this.label13.Location = new System.Drawing.Point(17, 17);
  534. this.label13.Name = "label13";
  535. this.label13.Size = new System.Drawing.Size(89, 12);
  536. this.label13.TabIndex = 0;
  537. this.label13.Text = "标尺长度计算:";
  538. //
  539. // textBold
  540. //
  541. this.textBold.FormattingEnabled = true;
  542. this.textBold.Location = new System.Drawing.Point(76, 151);
  543. this.textBold.Name = "textBold";
  544. this.textBold.Size = new System.Drawing.Size(72, 20);
  545. this.textBold.TabIndex = 57;
  546. //
  547. // label21
  548. //
  549. this.label21.AutoSize = true;
  550. this.label21.Location = new System.Drawing.Point(15, 154);
  551. this.label21.Name = "label21";
  552. this.label21.Size = new System.Drawing.Size(65, 12);
  553. this.label21.TabIndex = 56;
  554. this.label21.Text = "文字加粗:";
  555. //
  556. // LabelRulerStyleDialog
  557. //
  558. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  559. this.ClientSize = new System.Drawing.Size(533, 337);
  560. this.Controls.Add(this.groupBox3);
  561. this.Controls.Add(this.groupBox2);
  562. this.Controls.Add(this.groupBox1);
  563. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  564. this.MaximizeBox = false;
  565. this.MinimizeBox = false;
  566. this.Name = "LabelRulerStyleDialog";
  567. this.Text = "标尺设置";
  568. this.Controls.SetChildIndex(this.groupBox1, 0);
  569. this.Controls.SetChildIndex(this.groupBox2, 0);
  570. this.Controls.SetChildIndex(this.groupBox3, 0);
  571. this.groupBox1.ResumeLayout(false);
  572. this.groupBox2.ResumeLayout(false);
  573. this.groupBox2.PerformLayout();
  574. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).EndInit();
  575. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).EndInit();
  576. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
  577. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
  578. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
  579. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
  580. this.groupBox3.ResumeLayout(false);
  581. this.groupBox3.PerformLayout();
  582. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  583. this.ResumeLayout(false);
  584. }
  585. /// <summary>
  586. /// 初始化控件绑定
  587. /// </summary>
  588. private void InitializeData()
  589. {
  590. //绑定字体下拉
  591. System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
  592. ArrayList fontsItems = new ArrayList();
  593. foreach (FontFamily fontFamily in fonts.Families)
  594. {
  595. fontsItems.Add(fontFamily.Name);
  596. }
  597. this.comboBox1.DataSource = fontsItems;
  598. //绑定字体位置下拉
  599. this.comboBox2.DataSource = textPosition;
  600. this.colorsFormFont = new ColorsForm();
  601. this.colorsFormFont.StartPosition = FormStartPosition.CenterScreen;
  602. this.colorsFormFont.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  603. this.colorsFormLine = new ColorsForm();
  604. this.colorsFormLine.StartPosition = FormStartPosition.CenterScreen;
  605. this.colorsFormLine.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  606. this.colorsFormBackground = new ColorsForm();
  607. this.colorsFormBackground.StartPosition = FormStartPosition.CenterScreen;
  608. this.colorsFormBackground.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  609. this.colorsFormBorder = new ColorsForm();
  610. this.colorsFormBorder.StartPosition = FormStartPosition.CenterScreen;
  611. this.colorsFormBorder.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  612. if(this.drawObject.drawToolType == DrawToolType.DrawHandModeRuler || this.drawObject.drawToolType == DrawToolType.DrawPrestoredRuler)
  613. {
  614. this.groupBox3.Visible = false;
  615. }
  616. this.textBold.DataSource = new string[] { PdnResources.GetString("Menu.no.text"), PdnResources.GetString("Menu.Yes.text") };
  617. }
  618. /// <summary>
  619. /// 初始化标尺样式信息
  620. /// </summary>
  621. private void InitializeRulerModel()
  622. {
  623. this.rulerModel = (RulerModel)this.parentStyleModel;
  624. this.numericUpDown3.Value = this.rulerModel.textFontSize;//文字字号
  625. this.comboBox1.Text = this.rulerModel.textFont;//文字字体
  626. this.panel1.BackColor = Color.FromArgb(this.rulerModel.textColor);//文字颜色
  627. this.comboBox2.SelectedIndex = this.rulerModel.textPosition;//文字位置
  628. this.panel3.BackColor = Color.FromArgb(this.rulerModel.lineColor);//线条颜色
  629. this.numericUpDown4.Value = this.rulerModel.lineWidth;//线条宽度
  630. this.numericUpDown5.Value = this.rulerModel.verticalLineLength;//垂线长度
  631. this.numericUpDown6.Value = this.rulerModel.textHeight;//文字高度
  632. this.panel5.BackColor = Color.FromArgb(this.rulerModel.backColor);//背景颜色
  633. this.numericUpDown7.Value = this.rulerModel.backgroundSize;//背景大小
  634. this.panel6.BackColor = Color.FromArgb(this.rulerModel.borderColor);//边框颜色
  635. this.numericUpDown8.Value = this.rulerModel.borderWidth;//边框线宽
  636. this.textBold.SelectedIndex = this.rulerModel.textBold;//字体加粗
  637. this.numericUpDown1.Value = this.rulerModel.autoRulerValue;//自动标尺长度计算
  638. }
  639. /// <summary>
  640. /// 调色板回调函数
  641. /// </summary>
  642. /// <param name="sender"></param>
  643. /// <param name="ce"></param>
  644. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  645. {
  646. }
  647. /// <summary>
  648. /// 取消按钮
  649. /// </summary>
  650. /// <param name="sender"></param>
  651. /// <param name="e"></param>
  652. private void button2_Click(object sender, EventArgs e)
  653. {
  654. this.Close();
  655. }
  656. /// <summary>
  657. /// 应用按钮
  658. /// </summary>
  659. /// <param name="sender"></param>
  660. /// <param name="e"></param>
  661. private void button1_Click(object sender, EventArgs e)
  662. {
  663. //如果文字字号的值为空
  664. UpDownBase textFontUpDown = (UpDownBase)this.numericUpDown3;
  665. if (string.IsNullOrEmpty(textFontUpDown.Text))
  666. {
  667. this.numericUpDown3.Value = 15;
  668. }
  669. //如果线条宽度的值为空
  670. UpDownBase lineWidthUpDown = (UpDownBase)this.numericUpDown4;
  671. if (string.IsNullOrEmpty(lineWidthUpDown.Text))
  672. {
  673. this.numericUpDown4.Value = 4;
  674. }
  675. //如果垂线长度的值为空
  676. UpDownBase verticalLineLengthUpDown = (UpDownBase)this.numericUpDown5;
  677. if (string.IsNullOrEmpty(verticalLineLengthUpDown.Text))
  678. {
  679. this.numericUpDown5.Value = 11;
  680. }
  681. //如果文字高度的值为空
  682. UpDownBase fontHeightUpDown = (UpDownBase)this.numericUpDown6;
  683. if (string.IsNullOrEmpty(fontHeightUpDown.Text))
  684. {
  685. this.numericUpDown6.Value = 4;
  686. }
  687. //如果背景大小的值为空
  688. UpDownBase backgroundSizeUpDown = (UpDownBase)this.numericUpDown7;
  689. if (string.IsNullOrEmpty(backgroundSizeUpDown.Text))
  690. {
  691. this.numericUpDown7.Value = 10;
  692. }
  693. //如果边框线宽的值为空
  694. UpDownBase borderLineWidthUpDown = (UpDownBase)this.numericUpDown8;
  695. if (string.IsNullOrEmpty(borderLineWidthUpDown.Text))
  696. {
  697. this.numericUpDown8.Value = 6;
  698. }
  699. //如果标尺长度的值为空
  700. UpDownBase rulerValueUpDown = (UpDownBase)this.numericUpDown1;
  701. if (string.IsNullOrEmpty(rulerValueUpDown.Text))
  702. {
  703. this.numericUpDown1.Value = 4000;
  704. }
  705. rulerModel = new RulerModel();
  706. rulerModel.textFontSize = this.numericUpDown3.Value;//文字字号
  707. rulerModel.textFont = this.comboBox1.Text;//文字字体
  708. rulerModel.textColor = Convert.ToInt32(this.panel1.BackColor.ToArgb());//文字颜色
  709. rulerModel.textPosition = this.comboBox2.SelectedIndex;//文字位置
  710. rulerModel.textBold = this.textBold.SelectedIndex;//文字加粗
  711. rulerModel.lineColor = Convert.ToInt32(this.panel3.BackColor.ToArgb());//线条颜色
  712. rulerModel.lineWidth = this.numericUpDown4.Value;//线条宽度
  713. rulerModel.verticalLineLength = this.numericUpDown5.Value;//垂线长度
  714. rulerModel.textHeight = this.numericUpDown6.Value;//文字高度
  715. rulerModel.backColor = Convert.ToInt32(this.panel5.BackColor.ToArgb());//背景颜色
  716. rulerModel.backgroundSize = this.numericUpDown7.Value;//背景大小
  717. rulerModel.borderColor = Convert.ToInt32(this.panel6.BackColor.ToArgb());//边框颜色
  718. rulerModel.borderWidth = this.numericUpDown8.Value;//边框线宽
  719. rulerModel.autoRulerValue = this.numericUpDown1.Value;//自动标尺长度计算
  720. //自动标尺
  721. if(this.drawObject.drawToolType == DrawToolType.DrawAutoRuler)
  722. {
  723. DrawAutoRuler drawAutoRuler = (DrawAutoRuler)this.drawObject;
  724. drawAutoRuler.rulerModel = this.rulerModel;
  725. }
  726. //预存标尺
  727. if (this.drawObject.drawToolType == DrawToolType.DrawPrestoredRuler)
  728. {
  729. DrawPrestoredRuler drawPrestoredRuler = (DrawPrestoredRuler)this.drawObject;
  730. drawPrestoredRuler.rulerModel = this.rulerModel;
  731. }
  732. //手动标尺
  733. if (this.drawObject.drawToolType == DrawToolType.DrawHandModeRuler)
  734. {
  735. DrawHandModeRuler drawHandModeRuler = (DrawHandModeRuler)this.drawObject;
  736. drawHandModeRuler.rulerModel = this.rulerModel;
  737. }
  738. this.appWorkspace.ActiveDocumentWorkspace.Refresh();
  739. this.Close();
  740. }
  741. /// <summary>
  742. /// 文字颜色被点击
  743. /// </summary>
  744. /// <param name="sender"></param>
  745. /// <param name="e"></param>
  746. private void panel1_Click(object sender, EventArgs e)
  747. {
  748. this.colorsFormFont.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  749. this.colorsFormFont.setSaveBtn_Click(new System.EventHandler(this.colorsFormFontChanged));
  750. this.colorsFormFont.ShowDialog();
  751. }
  752. /// <summary>
  753. /// 文字颜色调色板
  754. /// </summary>
  755. /// <param name="sender"></param>
  756. /// <param name="e"></param>
  757. private void colorsFormFontChanged(object sender, EventArgs e)
  758. {
  759. this.panel1.BackColor = this.colorsFormFont.UserPrimaryColor.ToColor();
  760. this.colorsFormFont.Close();
  761. }
  762. /// <summary>
  763. /// 线条颜色被点击
  764. /// </summary>
  765. /// <param name="sender"></param>
  766. /// <param name="e"></param>
  767. private void panel3_Click(object sender, EventArgs e)
  768. {
  769. this.colorsFormLine.UserPrimaryColor = ColorBgra.FromColor(this.panel3.BackColor);
  770. this.colorsFormLine.setSaveBtn_Click(new System.EventHandler(this.colorsFormLineChanged));
  771. this.colorsFormLine.ShowDialog();
  772. }
  773. /// <summary>
  774. /// 线条颜色调色板
  775. /// </summary>
  776. /// <param name="sender"></param>
  777. /// <param name="e"></param>
  778. private void colorsFormLineChanged(object sender, EventArgs e)
  779. {
  780. this.panel3.BackColor = this.colorsFormLine.UserPrimaryColor.ToColor();
  781. this.colorsFormLine.Close();
  782. }
  783. /// <summary>
  784. /// 背景颜色被点击
  785. /// </summary>
  786. /// <param name="sender"></param>
  787. /// <param name="e"></param>
  788. private void panel5_Click(object sender, EventArgs e)
  789. {
  790. this.colorsFormBackground.UserPrimaryColor = ColorBgra.FromColor(this.panel5.BackColor);
  791. this.colorsFormBackground.setSaveBtn_Click(new System.EventHandler(this.colorsFormBackgroundChanged));
  792. this.colorsFormBackground.ShowDialog();
  793. }
  794. /// <summary>
  795. /// 背景颜色调色板
  796. /// </summary>
  797. /// <param name="sender"></param>
  798. /// <param name="e"></param>
  799. private void colorsFormBackgroundChanged(object sender, EventArgs e)
  800. {
  801. this.panel5.BackColor = this.colorsFormBackground.UserPrimaryColor.ToColor();
  802. this.colorsFormBackground.Close();
  803. }
  804. /// <summary>
  805. /// 边框颜色被点击
  806. /// </summary>
  807. /// <param name="sender"></param>
  808. /// <param name="e"></param>
  809. private void panel6_Click(object sender, EventArgs e)
  810. {
  811. this.colorsFormBorder.UserPrimaryColor = ColorBgra.FromColor(this.panel6.BackColor);
  812. this.colorsFormBorder.setSaveBtn_Click(new System.EventHandler(this.colorsFormBorderChanged));
  813. this.colorsFormBorder.ShowDialog();
  814. }
  815. /// <summary>
  816. /// 边框颜色调色板
  817. /// </summary>
  818. /// <param name="sender"></param>
  819. /// <param name="e"></param>
  820. private void colorsFormBorderChanged(object sender, EventArgs e)
  821. {
  822. this.panel6.BackColor = this.colorsFormBorder.UserPrimaryColor.ToColor();
  823. this.colorsFormBorder.Close();
  824. }
  825. }
  826. }