LabelRulerStyleDialog.cs 38 KB

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