RulerSettingDialog.cs 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  1. using PaintDotNet.Base.CommTool;
  2. using PaintDotNet.Base.SettingModel;
  3. using System;
  4. using System.Collections;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Windows.Forms;
  8. using static PaintDotNet.Base.SettingModel.RulerModel;
  9. namespace PaintDotNet.Setting
  10. {
  11. internal class RulerSettingDialog : PdnBaseForm
  12. {
  13. #region 属性
  14. #region 组件定义
  15. private System.Windows.Forms.GroupBox groupBox1;
  16. private System.Windows.Forms.Button cancelBtn;
  17. private System.Windows.Forms.Button saveBtn;
  18. private System.Windows.Forms.GroupBox groupBox2;
  19. private System.Windows.Forms.Label label4;
  20. private System.Windows.Forms.Label label7;
  21. private System.Windows.Forms.Label label5;
  22. private System.Windows.Forms.Label label6;
  23. private System.Windows.Forms.Label label12;
  24. private System.Windows.Forms.Label label8;
  25. private System.Windows.Forms.Label label11;
  26. private System.Windows.Forms.Label label10;
  27. private System.Windows.Forms.Label label3;
  28. private System.Windows.Forms.Label label2;
  29. private System.Windows.Forms.Label label9;
  30. private System.Windows.Forms.Label label1;
  31. private System.Windows.Forms.GroupBox previewGroupBox;
  32. private System.Windows.Forms.GroupBox groupBox4;
  33. private System.Windows.Forms.Label label14;
  34. private System.Windows.Forms.Label label13;
  35. private System.Windows.Forms.GroupBox groupBox5;
  36. private System.Windows.Forms.Label label16;
  37. private System.Windows.Forms.RadioButton rulerPositionVal2;
  38. private System.Windows.Forms.RadioButton rulerPositionVal4;
  39. private System.Windows.Forms.RadioButton rulerPositionVal3;
  40. private System.Windows.Forms.RadioButton rulerPositionVal1;
  41. private System.Windows.Forms.Label label15;
  42. private System.Windows.Forms.GroupBox groupBox6;
  43. private System.Windows.Forms.Button addRulerBtn;
  44. private System.Windows.Forms.Button deleteRulerBtn;
  45. private System.Windows.Forms.ComboBox textFontVal;
  46. private System.Windows.Forms.Label label17;
  47. private System.Windows.Forms.Label label19;
  48. private System.Windows.Forms.Label label18;
  49. private System.Windows.Forms.ComboBox textPositionVal;
  50. private System.Windows.Forms.Panel textColorPanel;
  51. private System.Windows.Forms.Panel lineColorPanel;
  52. private System.Windows.Forms.ListView listView1;
  53. private System.Windows.Forms.NumericUpDown textFontSizeVal;
  54. private System.Windows.Forms.NumericUpDown lineWidthVal;
  55. private System.Windows.Forms.NumericUpDown verticalLineLengthVal;
  56. private System.Windows.Forms.NumericUpDown textHeightVal;
  57. private System.Windows.Forms.Panel backColorPanel;
  58. private System.Windows.Forms.Panel borderColorPanel;
  59. private System.Windows.Forms.NumericUpDown backgroundSizeVal;
  60. private System.Windows.Forms.NumericUpDown borderWidthVal;
  61. private System.Windows.Forms.Panel previewPanel;
  62. private System.Windows.Forms.NumericUpDown autoRulerValueVal;
  63. private System.Windows.Forms.NumericUpDown rulerMarginVal;
  64. private System.Windows.Forms.Label label20;
  65. PaintDotNet.ColorsForm colorsFormFont;
  66. PaintDotNet.ColorsForm colorsFormLine;
  67. PaintDotNet.ColorsForm colorsFormBackground;
  68. PaintDotNet.ColorsForm colorsFormBorder;
  69. private System.Windows.Forms.Panel panel2;
  70. private System.Windows.Forms.Panel panel1;
  71. private Form addRulerform = new PdnBaseForm();
  72. private TextBox nameValue = new TextBox();
  73. private NumericUpDown lengthVal = new NumericUpDown();
  74. #endregion
  75. private RulerModel rulerModel = new RulerModel();
  76. private PresetRuler tempPresetRuler = new PresetRuler();
  77. private ComboBox textBold;
  78. private Label label21;
  79. private AppWorkspace appWorkspace;
  80. #endregion
  81. public RulerSettingDialog(AppWorkspace appWorkspace)
  82. {
  83. this.appWorkspace = appWorkspace;
  84. InitializeComponent();
  85. InitializeLanguageText();
  86. InitializeComponent2();
  87. addRulerformInit();
  88. readData();
  89. buildListView();
  90. }
  91. #region 组件相关
  92. #region Windows Form Designer generated code
  93. /// <summary>
  94. /// Required designer variable.
  95. /// </summary>
  96. private System.ComponentModel.IContainer components = null;
  97. /// <summary>
  98. /// Clean up any resources being used.
  99. /// </summary>
  100. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  101. protected override void Dispose(bool disposing)
  102. {
  103. if (disposing && (components != null))
  104. {
  105. components.Dispose();
  106. }
  107. base.Dispose(disposing);
  108. }
  109. private void InitializeLanguageText()
  110. {
  111. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  112. this.cancelBtn.Text = PdnResources.GetString("Menu.cancel.text");
  113. this.saveBtn.Text = PdnResources.GetString("Menu.application.text");
  114. this.groupBox2.Text = PdnResources.GetString("Menu.Set.typesettings.Stylesetting.text");
  115. this.label12.Text = PdnResources.GetString("Menu.Set.Rulersettings.Borderlinewidth.text") + ":";
  116. this.label8.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textheight.text") + ":";
  117. this.label4.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textposition.text") + ":";
  118. this.label11.Text = PdnResources.GetString("Menu.backgroundcolor.text") + ":";
  119. this.label10.Text = PdnResources.GetString("Menu.Set.Rulersettings.Borderlinecolor.text") + ":";
  120. this.label3.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linecolor.text") + ":";
  121. this.label2.Text = PdnResources.GetString("Menu.Set.Rulersettings.lengthofperpendicular.text") + ":";
  122. this.label9.Text = PdnResources.GetString("Menu.Backgroundsize.text") + ":";
  123. this.label7.Text = PdnResources.GetString("Menu.Set.Rulersettings.Fontsize.text") + ":";
  124. this.label1.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linewidth.text") + ":";
  125. this.label5.Text = PdnResources.GetString("Menu.Textcolor.text") + ":";
  126. this.label6.Text = PdnResources.GetString("Menu.Textfont.text") + ":";
  127. this.previewGroupBox.Text = PdnResources.GetString("Menu.Preview.text");
  128. this.groupBox4.Text = PdnResources.GetString("Menu.Set.Rulersettings.automaticannotation.text");
  129. this.label14.Text = PdnResources.GetString("Menu.Set.Rulersettings.Dividebymagnification.text");
  130. this.label13.Text = PdnResources.GetString("Menu.Set.Rulersettings.Calculationoflabellength.text") + ":";
  131. this.groupBox5.Text = PdnResources.GetString("Menu.Set.Rulersettings.Rulerposition.text");
  132. this.label16.Text = PdnResources.GetString("Menu.Set.Rulersettings.Labelmargin.text") + ":";
  133. this.rulerPositionVal2.Text = PdnResources.GetString("Menu.Upperright.text");
  134. this.rulerPositionVal4.Text = PdnResources.GetString("Menu.Lowerright.text");
  135. this.rulerPositionVal3.Text = PdnResources.GetString("Menu.Lowerleft.text");
  136. this.rulerPositionVal1.Text = PdnResources.GetString("Menu.Upperleft.text");
  137. this.label15.Text = PdnResources.GetString("Menu.Set.Rulersettings.Rulerposition.text") + ":";
  138. this.groupBox6.Text = PdnResources.GetString("Menu.Set.Rulersettings.Pre-storedannotation.text");
  139. this.Text = PdnResources.GetString("Menu.Setting.RuleSetting.Text");
  140. }
  141. /// <summary>
  142. /// Required method for Designer support - do not modify
  143. /// the contents of this method with the code editor.
  144. /// </summary>
  145. private void InitializeComponent()
  146. {
  147. this.groupBox1 = new System.Windows.Forms.GroupBox();
  148. this.cancelBtn = new System.Windows.Forms.Button();
  149. this.saveBtn = new System.Windows.Forms.Button();
  150. this.groupBox2 = new System.Windows.Forms.GroupBox();
  151. this.textBold = new System.Windows.Forms.ComboBox();
  152. this.label21 = new System.Windows.Forms.Label();
  153. this.panel2 = new System.Windows.Forms.Panel();
  154. this.panel1 = new System.Windows.Forms.Panel();
  155. this.borderColorPanel = new System.Windows.Forms.Panel();
  156. this.backColorPanel = new System.Windows.Forms.Panel();
  157. this.textHeightVal = new System.Windows.Forms.NumericUpDown();
  158. this.backgroundSizeVal = new System.Windows.Forms.NumericUpDown();
  159. this.verticalLineLengthVal = new System.Windows.Forms.NumericUpDown();
  160. this.borderWidthVal = new System.Windows.Forms.NumericUpDown();
  161. this.lineWidthVal = new System.Windows.Forms.NumericUpDown();
  162. this.textFontSizeVal = new System.Windows.Forms.NumericUpDown();
  163. this.lineColorPanel = new System.Windows.Forms.Panel();
  164. this.textColorPanel = new System.Windows.Forms.Panel();
  165. this.textPositionVal = new System.Windows.Forms.ComboBox();
  166. this.label19 = new System.Windows.Forms.Label();
  167. this.label18 = new System.Windows.Forms.Label();
  168. this.label17 = new System.Windows.Forms.Label();
  169. this.textFontVal = new System.Windows.Forms.ComboBox();
  170. this.label12 = new System.Windows.Forms.Label();
  171. this.label8 = new System.Windows.Forms.Label();
  172. this.label4 = new System.Windows.Forms.Label();
  173. this.label11 = new System.Windows.Forms.Label();
  174. this.label10 = new System.Windows.Forms.Label();
  175. this.label3 = new System.Windows.Forms.Label();
  176. this.label2 = new System.Windows.Forms.Label();
  177. this.label9 = new System.Windows.Forms.Label();
  178. this.label7 = new System.Windows.Forms.Label();
  179. this.label1 = new System.Windows.Forms.Label();
  180. this.label5 = new System.Windows.Forms.Label();
  181. this.label6 = new System.Windows.Forms.Label();
  182. this.previewGroupBox = new System.Windows.Forms.GroupBox();
  183. this.previewPanel = new System.Windows.Forms.Panel();
  184. this.groupBox4 = new System.Windows.Forms.GroupBox();
  185. this.autoRulerValueVal = new System.Windows.Forms.NumericUpDown();
  186. this.label14 = new System.Windows.Forms.Label();
  187. this.label13 = new System.Windows.Forms.Label();
  188. this.groupBox5 = new System.Windows.Forms.GroupBox();
  189. this.rulerMarginVal = new System.Windows.Forms.NumericUpDown();
  190. this.label20 = new System.Windows.Forms.Label();
  191. this.label16 = new System.Windows.Forms.Label();
  192. this.rulerPositionVal2 = new System.Windows.Forms.RadioButton();
  193. this.rulerPositionVal4 = new System.Windows.Forms.RadioButton();
  194. this.rulerPositionVal3 = new System.Windows.Forms.RadioButton();
  195. this.rulerPositionVal1 = new System.Windows.Forms.RadioButton();
  196. this.label15 = new System.Windows.Forms.Label();
  197. this.groupBox6 = new System.Windows.Forms.GroupBox();
  198. this.listView1 = new System.Windows.Forms.ListView();
  199. this.addRulerBtn = new System.Windows.Forms.Button();
  200. this.deleteRulerBtn = new System.Windows.Forms.Button();
  201. this.groupBox1.SuspendLayout();
  202. this.groupBox2.SuspendLayout();
  203. ((System.ComponentModel.ISupportInitialize)(this.textHeightVal)).BeginInit();
  204. ((System.ComponentModel.ISupportInitialize)(this.backgroundSizeVal)).BeginInit();
  205. ((System.ComponentModel.ISupportInitialize)(this.verticalLineLengthVal)).BeginInit();
  206. ((System.ComponentModel.ISupportInitialize)(this.borderWidthVal)).BeginInit();
  207. ((System.ComponentModel.ISupportInitialize)(this.lineWidthVal)).BeginInit();
  208. ((System.ComponentModel.ISupportInitialize)(this.textFontSizeVal)).BeginInit();
  209. this.previewGroupBox.SuspendLayout();
  210. this.groupBox4.SuspendLayout();
  211. ((System.ComponentModel.ISupportInitialize)(this.autoRulerValueVal)).BeginInit();
  212. this.groupBox5.SuspendLayout();
  213. ((System.ComponentModel.ISupportInitialize)(this.rulerMarginVal)).BeginInit();
  214. this.groupBox6.SuspendLayout();
  215. this.SuspendLayout();
  216. //
  217. // groupBox1
  218. //
  219. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  220. | System.Windows.Forms.AnchorStyles.Right)));
  221. this.groupBox1.Controls.Add(this.cancelBtn);
  222. this.groupBox1.Controls.Add(this.saveBtn);
  223. this.groupBox1.Location = new System.Drawing.Point(13, 13);
  224. this.groupBox1.Name = "groupBox1";
  225. this.groupBox1.Size = new System.Drawing.Size(508, 58);
  226. this.groupBox1.TabIndex = 2;
  227. this.groupBox1.TabStop = false;
  228. this.groupBox1.Text = "操作";
  229. //
  230. // cancelBtn
  231. //
  232. this.cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Right;
  233. this.cancelBtn.Location = new System.Drawing.Point(420, 21);
  234. this.cancelBtn.Name = "cancelBtn";
  235. this.cancelBtn.Size = new System.Drawing.Size(75, 23);
  236. this.cancelBtn.TabIndex = 1;
  237. this.cancelBtn.Text = "取消";
  238. this.cancelBtn.UseVisualStyleBackColor = true;
  239. this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
  240. //
  241. // saveBtn
  242. //
  243. this.saveBtn.Anchor = System.Windows.Forms.AnchorStyles.Right;
  244. this.saveBtn.Location = new System.Drawing.Point(339, 21);
  245. this.saveBtn.Name = "saveBtn";
  246. this.saveBtn.Size = new System.Drawing.Size(75, 23);
  247. this.saveBtn.TabIndex = 0;
  248. this.saveBtn.Text = "确定";
  249. this.saveBtn.UseVisualStyleBackColor = true;
  250. this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
  251. //
  252. // groupBox2
  253. //
  254. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  255. | System.Windows.Forms.AnchorStyles.Right)));
  256. this.groupBox2.Controls.Add(this.textBold);
  257. this.groupBox2.Controls.Add(this.label21);
  258. this.groupBox2.Controls.Add(this.panel2);
  259. this.groupBox2.Controls.Add(this.panel1);
  260. this.groupBox2.Controls.Add(this.borderColorPanel);
  261. this.groupBox2.Controls.Add(this.backColorPanel);
  262. this.groupBox2.Controls.Add(this.textHeightVal);
  263. this.groupBox2.Controls.Add(this.backgroundSizeVal);
  264. this.groupBox2.Controls.Add(this.verticalLineLengthVal);
  265. this.groupBox2.Controls.Add(this.borderWidthVal);
  266. this.groupBox2.Controls.Add(this.lineWidthVal);
  267. this.groupBox2.Controls.Add(this.textFontSizeVal);
  268. this.groupBox2.Controls.Add(this.lineColorPanel);
  269. this.groupBox2.Controls.Add(this.textColorPanel);
  270. this.groupBox2.Controls.Add(this.textPositionVal);
  271. this.groupBox2.Controls.Add(this.label19);
  272. this.groupBox2.Controls.Add(this.label18);
  273. this.groupBox2.Controls.Add(this.label17);
  274. this.groupBox2.Controls.Add(this.textFontVal);
  275. this.groupBox2.Controls.Add(this.label12);
  276. this.groupBox2.Controls.Add(this.label8);
  277. this.groupBox2.Controls.Add(this.label4);
  278. this.groupBox2.Controls.Add(this.label11);
  279. this.groupBox2.Controls.Add(this.label10);
  280. this.groupBox2.Controls.Add(this.label3);
  281. this.groupBox2.Controls.Add(this.label2);
  282. this.groupBox2.Controls.Add(this.label9);
  283. this.groupBox2.Controls.Add(this.label7);
  284. this.groupBox2.Controls.Add(this.label1);
  285. this.groupBox2.Controls.Add(this.label5);
  286. this.groupBox2.Controls.Add(this.label6);
  287. this.groupBox2.Location = new System.Drawing.Point(13, 77);
  288. this.groupBox2.Name = "groupBox2";
  289. this.groupBox2.Size = new System.Drawing.Size(508, 167);
  290. this.groupBox2.TabIndex = 3;
  291. this.groupBox2.TabStop = false;
  292. this.groupBox2.Text = "样式设置";
  293. //
  294. // textBold
  295. //
  296. this.textBold.FormattingEnabled = true;
  297. this.textBold.Location = new System.Drawing.Point(84, 138);
  298. this.textBold.Name = "textBold";
  299. this.textBold.Size = new System.Drawing.Size(72, 20);
  300. this.textBold.TabIndex = 55;
  301. this.textBold.SelectedIndexChanged += new System.EventHandler(this.textBold_SelectedIndexChanged);
  302. //
  303. // label21
  304. //
  305. this.label21.AutoSize = true;
  306. this.label21.Location = new System.Drawing.Point(15, 142);
  307. this.label21.Name = "label21";
  308. this.label21.Size = new System.Drawing.Size(65, 12);
  309. this.label21.TabIndex = 54;
  310. this.label21.Text = "文字加粗:";
  311. //
  312. // panel2
  313. //
  314. this.panel2.BackColor = System.Drawing.SystemColors.WindowText;
  315. this.panel2.Location = new System.Drawing.Point(333, 13);
  316. this.panel2.Name = "panel2";
  317. this.panel2.Size = new System.Drawing.Size(1, 146);
  318. this.panel2.TabIndex = 53;
  319. //
  320. // panel1
  321. //
  322. this.panel1.BackColor = System.Drawing.SystemColors.WindowText;
  323. this.panel1.Location = new System.Drawing.Point(166, 13);
  324. this.panel1.Name = "panel1";
  325. this.panel1.Size = new System.Drawing.Size(1, 146);
  326. this.panel1.TabIndex = 53;
  327. //
  328. // borderColorPanel
  329. //
  330. this.borderColorPanel.BackColor = System.Drawing.SystemColors.Window;
  331. this.borderColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  332. this.borderColorPanel.Location = new System.Drawing.Point(427, 81);
  333. this.borderColorPanel.Name = "borderColorPanel";
  334. this.borderColorPanel.Size = new System.Drawing.Size(72, 21);
  335. this.borderColorPanel.TabIndex = 52;
  336. this.borderColorPanel.Click += new System.EventHandler(this.borderColorValPanel_Click);
  337. //
  338. // backColorPanel
  339. //
  340. this.backColorPanel.BackColor = System.Drawing.SystemColors.Window;
  341. this.backColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  342. this.backColorPanel.Location = new System.Drawing.Point(427, 23);
  343. this.backColorPanel.Name = "backColorPanel";
  344. this.backColorPanel.Size = new System.Drawing.Size(72, 21);
  345. this.backColorPanel.TabIndex = 51;
  346. this.backColorPanel.Click += new System.EventHandler(this.backColorPanel_Click);
  347. //
  348. // textHeightVal
  349. //
  350. this.textHeightVal.Location = new System.Drawing.Point(254, 110);
  351. this.textHeightVal.Name = "textHeightVal";
  352. this.textHeightVal.Size = new System.Drawing.Size(55, 21);
  353. this.textHeightVal.TabIndex = 50;
  354. this.textHeightVal.ValueChanged += new System.EventHandler(this.textHeightVal_ValueChanged);
  355. //
  356. // backgroundSizeVal
  357. //
  358. this.backgroundSizeVal.Location = new System.Drawing.Point(427, 52);
  359. this.backgroundSizeVal.Name = "backgroundSizeVal";
  360. this.backgroundSizeVal.Size = new System.Drawing.Size(55, 21);
  361. this.backgroundSizeVal.TabIndex = 50;
  362. this.backgroundSizeVal.ValueChanged += new System.EventHandler(this.backgroundSizeVal_ValueChanged);
  363. //
  364. // verticalLineLengthVal
  365. //
  366. this.verticalLineLengthVal.Location = new System.Drawing.Point(254, 81);
  367. this.verticalLineLengthVal.Name = "verticalLineLengthVal";
  368. this.verticalLineLengthVal.Size = new System.Drawing.Size(55, 21);
  369. this.verticalLineLengthVal.TabIndex = 50;
  370. this.verticalLineLengthVal.ValueChanged += new System.EventHandler(this.verticalLineLengthVal_ValueChanged);
  371. //
  372. // borderWidthVal
  373. //
  374. this.borderWidthVal.Location = new System.Drawing.Point(427, 109);
  375. this.borderWidthVal.Name = "borderWidthVal";
  376. this.borderWidthVal.Size = new System.Drawing.Size(72, 21);
  377. this.borderWidthVal.TabIndex = 50;
  378. this.borderWidthVal.ValueChanged += new System.EventHandler(this.borderWidthVal_ValueChanged);
  379. //
  380. // lineWidthVal
  381. //
  382. this.lineWidthVal.Location = new System.Drawing.Point(254, 53);
  383. this.lineWidthVal.Minimum = new decimal(new int[] {
  384. 1,
  385. 0,
  386. 0,
  387. 0});
  388. this.lineWidthVal.Name = "lineWidthVal";
  389. this.lineWidthVal.Size = new System.Drawing.Size(72, 21);
  390. this.lineWidthVal.TabIndex = 50;
  391. this.lineWidthVal.Value = new decimal(new int[] {
  392. 1,
  393. 0,
  394. 0,
  395. 0});
  396. this.lineWidthVal.ValueChanged += new System.EventHandler(this.lineWidthVal_ValueChanged);
  397. //
  398. // textFontSizeVal
  399. //
  400. this.textFontSizeVal.Location = new System.Drawing.Point(84, 23);
  401. this.textFontSizeVal.Minimum = new decimal(new int[] {
  402. 1,
  403. 0,
  404. 0,
  405. 0});
  406. this.textFontSizeVal.Name = "textFontSizeVal";
  407. this.textFontSizeVal.Size = new System.Drawing.Size(72, 21);
  408. this.textFontSizeVal.TabIndex = 50;
  409. this.textFontSizeVal.Value = new decimal(new int[] {
  410. 1,
  411. 0,
  412. 0,
  413. 0});
  414. this.textFontSizeVal.ValueChanged += new System.EventHandler(this.textFontSizeVal_ValueChanged);
  415. //
  416. // lineColorPanel
  417. //
  418. this.lineColorPanel.BackColor = System.Drawing.SystemColors.Window;
  419. this.lineColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  420. this.lineColorPanel.Location = new System.Drawing.Point(254, 23);
  421. this.lineColorPanel.Name = "lineColorPanel";
  422. this.lineColorPanel.Size = new System.Drawing.Size(72, 21);
  423. this.lineColorPanel.TabIndex = 49;
  424. this.lineColorPanel.Click += new System.EventHandler(this.lineColorPanel_Click);
  425. //
  426. // textColorPanel
  427. //
  428. this.textColorPanel.BackColor = System.Drawing.SystemColors.Window;
  429. this.textColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  430. this.textColorPanel.Location = new System.Drawing.Point(84, 81);
  431. this.textColorPanel.Name = "textColorPanel";
  432. this.textColorPanel.Size = new System.Drawing.Size(72, 21);
  433. this.textColorPanel.TabIndex = 0;
  434. this.textColorPanel.Click += new System.EventHandler(this.textColorPanel_Click);
  435. //
  436. // textPositionVal
  437. //
  438. this.textPositionVal.FormattingEnabled = true;
  439. this.textPositionVal.Location = new System.Drawing.Point(84, 110);
  440. this.textPositionVal.Name = "textPositionVal";
  441. this.textPositionVal.Size = new System.Drawing.Size(72, 20);
  442. this.textPositionVal.TabIndex = 40;
  443. this.textPositionVal.SelectedIndexChanged += new System.EventHandler(this.textPositionVal_SelectedIndexChanged);
  444. //
  445. // label19
  446. //
  447. this.label19.AutoSize = true;
  448. this.label19.Location = new System.Drawing.Point(488, 57);
  449. this.label19.Name = "label19";
  450. this.label19.Size = new System.Drawing.Size(11, 12);
  451. this.label19.TabIndex = 37;
  452. this.label19.Text = "%";
  453. //
  454. // label18
  455. //
  456. this.label18.AutoSize = true;
  457. this.label18.Location = new System.Drawing.Point(314, 114);
  458. this.label18.Name = "label18";
  459. this.label18.Size = new System.Drawing.Size(11, 12);
  460. this.label18.TabIndex = 35;
  461. this.label18.Text = "%";
  462. //
  463. // label17
  464. //
  465. this.label17.AutoSize = true;
  466. this.label17.Location = new System.Drawing.Point(315, 85);
  467. this.label17.Name = "label17";
  468. this.label17.Size = new System.Drawing.Size(11, 12);
  469. this.label17.TabIndex = 32;
  470. this.label17.Text = "%";
  471. //
  472. // textFontVal
  473. //
  474. this.textFontVal.FormattingEnabled = true;
  475. this.textFontVal.Location = new System.Drawing.Point(84, 53);
  476. this.textFontVal.Name = "textFontVal";
  477. this.textFontVal.Size = new System.Drawing.Size(72, 20);
  478. this.textFontVal.TabIndex = 0;
  479. this.textFontVal.SelectedIndexChanged += new System.EventHandler(this.textFontVal_SelectedIndexChanged);
  480. //
  481. // label12
  482. //
  483. this.label12.AutoSize = true;
  484. this.label12.Location = new System.Drawing.Point(349, 114);
  485. this.label12.Name = "label12";
  486. this.label12.Size = new System.Drawing.Size(65, 12);
  487. this.label12.TabIndex = 33;
  488. this.label12.Text = "边框线宽:";
  489. //
  490. // label8
  491. //
  492. this.label8.AutoSize = true;
  493. this.label8.Location = new System.Drawing.Point(182, 114);
  494. this.label8.Name = "label8";
  495. this.label8.Size = new System.Drawing.Size(65, 12);
  496. this.label8.TabIndex = 33;
  497. this.label8.Text = "文字高度:";
  498. //
  499. // label4
  500. //
  501. this.label4.AutoSize = true;
  502. this.label4.Location = new System.Drawing.Point(15, 114);
  503. this.label4.Name = "label4";
  504. this.label4.Size = new System.Drawing.Size(65, 12);
  505. this.label4.TabIndex = 33;
  506. this.label4.Text = "文字位置:";
  507. //
  508. // label11
  509. //
  510. this.label11.AutoSize = true;
  511. this.label11.Location = new System.Drawing.Point(349, 27);
  512. this.label11.Name = "label11";
  513. this.label11.Size = new System.Drawing.Size(65, 12);
  514. this.label11.TabIndex = 27;
  515. this.label11.Text = "背景颜色:";
  516. //
  517. // label10
  518. //
  519. this.label10.AutoSize = true;
  520. this.label10.Location = new System.Drawing.Point(349, 85);
  521. this.label10.Name = "label10";
  522. this.label10.Size = new System.Drawing.Size(65, 12);
  523. this.label10.TabIndex = 31;
  524. this.label10.Text = "边框颜色:";
  525. //
  526. // label3
  527. //
  528. this.label3.AutoSize = true;
  529. this.label3.Location = new System.Drawing.Point(182, 27);
  530. this.label3.Name = "label3";
  531. this.label3.Size = new System.Drawing.Size(65, 12);
  532. this.label3.TabIndex = 27;
  533. this.label3.Text = "线条颜色:";
  534. //
  535. // label2
  536. //
  537. this.label2.AutoSize = true;
  538. this.label2.Location = new System.Drawing.Point(182, 85);
  539. this.label2.Name = "label2";
  540. this.label2.Size = new System.Drawing.Size(65, 12);
  541. this.label2.TabIndex = 31;
  542. this.label2.Text = "垂线长度:";
  543. //
  544. // label9
  545. //
  546. this.label9.AutoSize = true;
  547. this.label9.Location = new System.Drawing.Point(349, 57);
  548. this.label9.Name = "label9";
  549. this.label9.Size = new System.Drawing.Size(65, 12);
  550. this.label9.TabIndex = 29;
  551. this.label9.Text = "背景大小:";
  552. //
  553. // label7
  554. //
  555. this.label7.AutoSize = true;
  556. this.label7.Location = new System.Drawing.Point(15, 27);
  557. this.label7.Name = "label7";
  558. this.label7.Size = new System.Drawing.Size(65, 12);
  559. this.label7.TabIndex = 27;
  560. this.label7.Text = "文字字号:";
  561. //
  562. // label1
  563. //
  564. this.label1.AutoSize = true;
  565. this.label1.Location = new System.Drawing.Point(182, 57);
  566. this.label1.Name = "label1";
  567. this.label1.Size = new System.Drawing.Size(65, 12);
  568. this.label1.TabIndex = 29;
  569. this.label1.Text = "线条宽度:";
  570. //
  571. // label5
  572. //
  573. this.label5.AutoSize = true;
  574. this.label5.Location = new System.Drawing.Point(15, 85);
  575. this.label5.Name = "label5";
  576. this.label5.Size = new System.Drawing.Size(65, 12);
  577. this.label5.TabIndex = 31;
  578. this.label5.Text = "文字颜色:";
  579. //
  580. // label6
  581. //
  582. this.label6.AutoSize = true;
  583. this.label6.Location = new System.Drawing.Point(15, 57);
  584. this.label6.Name = "label6";
  585. this.label6.Size = new System.Drawing.Size(65, 12);
  586. this.label6.TabIndex = 29;
  587. this.label6.Text = "文字字体:";
  588. //
  589. // previewGroupBox
  590. //
  591. this.previewGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  592. | System.Windows.Forms.AnchorStyles.Right)));
  593. this.previewGroupBox.Controls.Add(this.previewPanel);
  594. this.previewGroupBox.Location = new System.Drawing.Point(13, 246);
  595. this.previewGroupBox.Name = "previewGroupBox";
  596. this.previewGroupBox.Size = new System.Drawing.Size(508, 180);
  597. this.previewGroupBox.TabIndex = 4;
  598. this.previewGroupBox.TabStop = false;
  599. this.previewGroupBox.Text = "预览";
  600. //
  601. // previewPanel
  602. //
  603. this.previewPanel.Location = new System.Drawing.Point(7, 12);
  604. this.previewPanel.Name = "previewPanel";
  605. this.previewPanel.Size = new System.Drawing.Size(495, 153);
  606. this.previewPanel.TabIndex = 0;
  607. this.previewPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.previewPanel_Paint);
  608. //
  609. // groupBox4
  610. //
  611. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  612. | System.Windows.Forms.AnchorStyles.Right)));
  613. this.groupBox4.Controls.Add(this.autoRulerValueVal);
  614. this.groupBox4.Controls.Add(this.label14);
  615. this.groupBox4.Controls.Add(this.label13);
  616. this.groupBox4.Location = new System.Drawing.Point(13, 417);
  617. this.groupBox4.Name = "groupBox4";
  618. this.groupBox4.Size = new System.Drawing.Size(246, 90);
  619. this.groupBox4.TabIndex = 5;
  620. this.groupBox4.TabStop = false;
  621. this.groupBox4.Text = "自动标注";
  622. //
  623. // autoRulerValueVal
  624. //
  625. this.autoRulerValueVal.Location = new System.Drawing.Point(110, 37);
  626. this.autoRulerValueVal.Maximum = new decimal(new int[] {
  627. 1410065407,
  628. 2,
  629. 0,
  630. 0});
  631. this.autoRulerValueVal.Name = "autoRulerValueVal";
  632. this.autoRulerValueVal.Size = new System.Drawing.Size(117, 21);
  633. this.autoRulerValueVal.TabIndex = 51;
  634. this.autoRulerValueVal.ValueChanged += new System.EventHandler(this.autoRulerValueVal_ValueChanged);
  635. //
  636. // label14
  637. //
  638. this.label14.AutoSize = true;
  639. this.label14.Location = new System.Drawing.Point(150, 61);
  640. this.label14.Name = "label14";
  641. this.label14.Size = new System.Drawing.Size(77, 12);
  642. this.label14.TabIndex = 37;
  643. this.label14.Text = "除以放大倍数";
  644. //
  645. // label13
  646. //
  647. this.label13.AutoSize = true;
  648. this.label13.Location = new System.Drawing.Point(15, 41);
  649. this.label13.Name = "label13";
  650. this.label13.Size = new System.Drawing.Size(89, 12);
  651. this.label13.TabIndex = 35;
  652. this.label13.Text = "自动长度计算:";
  653. //
  654. // groupBox5
  655. //
  656. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  657. | System.Windows.Forms.AnchorStyles.Right)));
  658. this.groupBox5.Controls.Add(this.rulerMarginVal);
  659. this.groupBox5.Controls.Add(this.label20);
  660. this.groupBox5.Controls.Add(this.label16);
  661. this.groupBox5.Controls.Add(this.rulerPositionVal2);
  662. this.groupBox5.Controls.Add(this.rulerPositionVal4);
  663. this.groupBox5.Controls.Add(this.rulerPositionVal3);
  664. this.groupBox5.Controls.Add(this.rulerPositionVal1);
  665. this.groupBox5.Controls.Add(this.label15);
  666. this.groupBox5.Location = new System.Drawing.Point(269, 417);
  667. this.groupBox5.Name = "groupBox5";
  668. this.groupBox5.Size = new System.Drawing.Size(252, 90);
  669. this.groupBox5.TabIndex = 6;
  670. this.groupBox5.TabStop = false;
  671. this.groupBox5.Text = "标尺位置";
  672. //
  673. // rulerMarginVal
  674. //
  675. this.rulerMarginVal.DecimalPlaces = 2;
  676. this.rulerMarginVal.Location = new System.Drawing.Point(77, 57);
  677. this.rulerMarginVal.Name = "rulerMarginVal";
  678. this.rulerMarginVal.Size = new System.Drawing.Size(132, 21);
  679. this.rulerMarginVal.TabIndex = 52;
  680. this.rulerMarginVal.ValueChanged += new System.EventHandler(this.rulerMarginVal_ValueChanged);
  681. //
  682. // label20
  683. //
  684. this.label20.AutoSize = true;
  685. this.label20.Location = new System.Drawing.Point(215, 61);
  686. this.label20.Name = "label20";
  687. this.label20.Size = new System.Drawing.Size(11, 12);
  688. this.label20.TabIndex = 51;
  689. this.label20.Text = "%";
  690. //
  691. // label16
  692. //
  693. this.label16.AutoSize = true;
  694. this.label16.Location = new System.Drawing.Point(6, 61);
  695. this.label16.Name = "label16";
  696. this.label16.Size = new System.Drawing.Size(65, 12);
  697. this.label16.TabIndex = 43;
  698. this.label16.Text = "标注边距:";
  699. //
  700. // rulerPositionVal2
  701. //
  702. this.rulerPositionVal2.AutoSize = true;
  703. this.rulerPositionVal2.Location = new System.Drawing.Point(155, 13);
  704. this.rulerPositionVal2.Name = "rulerPositionVal2";
  705. this.rulerPositionVal2.Size = new System.Drawing.Size(47, 16);
  706. this.rulerPositionVal2.TabIndex = 42;
  707. this.rulerPositionVal2.TabStop = true;
  708. this.rulerPositionVal2.Text = "右上";
  709. this.rulerPositionVal2.UseVisualStyleBackColor = true;
  710. this.rulerPositionVal2.CheckedChanged += new System.EventHandler(this.rulerPositionVal2_CheckedChanged);
  711. //
  712. // rulerPositionVal4
  713. //
  714. this.rulerPositionVal4.AutoSize = true;
  715. this.rulerPositionVal4.Location = new System.Drawing.Point(155, 35);
  716. this.rulerPositionVal4.Name = "rulerPositionVal4";
  717. this.rulerPositionVal4.Size = new System.Drawing.Size(47, 16);
  718. this.rulerPositionVal4.TabIndex = 41;
  719. this.rulerPositionVal4.TabStop = true;
  720. this.rulerPositionVal4.Text = "右下";
  721. this.rulerPositionVal4.UseVisualStyleBackColor = true;
  722. this.rulerPositionVal4.CheckedChanged += new System.EventHandler(this.rulerPositionVal4_CheckedChanged);
  723. //
  724. // rulerPositionVal3
  725. //
  726. this.rulerPositionVal3.AutoSize = true;
  727. this.rulerPositionVal3.Location = new System.Drawing.Point(100, 35);
  728. this.rulerPositionVal3.Name = "rulerPositionVal3";
  729. this.rulerPositionVal3.Size = new System.Drawing.Size(47, 16);
  730. this.rulerPositionVal3.TabIndex = 40;
  731. this.rulerPositionVal3.TabStop = true;
  732. this.rulerPositionVal3.Text = "左下";
  733. this.rulerPositionVal3.UseVisualStyleBackColor = true;
  734. this.rulerPositionVal3.CheckedChanged += new System.EventHandler(this.rulerPositionVal3_CheckedChanged);
  735. //
  736. // rulerPositionVal1
  737. //
  738. this.rulerPositionVal1.AutoSize = true;
  739. this.rulerPositionVal1.Checked = true;
  740. this.rulerPositionVal1.Location = new System.Drawing.Point(100, 13);
  741. this.rulerPositionVal1.Name = "rulerPositionVal1";
  742. this.rulerPositionVal1.Size = new System.Drawing.Size(47, 16);
  743. this.rulerPositionVal1.TabIndex = 39;
  744. this.rulerPositionVal1.TabStop = true;
  745. this.rulerPositionVal1.Text = "左上";
  746. this.rulerPositionVal1.UseVisualStyleBackColor = true;
  747. this.rulerPositionVal1.CheckedChanged += new System.EventHandler(this.rulerPositionVal1_CheckedChanged);
  748. //
  749. // label15
  750. //
  751. this.label15.AutoSize = true;
  752. this.label15.Location = new System.Drawing.Point(6, 26);
  753. this.label15.Name = "label15";
  754. this.label15.Size = new System.Drawing.Size(65, 12);
  755. this.label15.TabIndex = 38;
  756. this.label15.Text = "标尺位置:";
  757. //
  758. // groupBox6
  759. //
  760. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  761. | System.Windows.Forms.AnchorStyles.Right)));
  762. this.groupBox6.Controls.Add(this.listView1);
  763. this.groupBox6.Controls.Add(this.addRulerBtn);
  764. this.groupBox6.Controls.Add(this.deleteRulerBtn);
  765. this.groupBox6.Location = new System.Drawing.Point(13, 513);
  766. this.groupBox6.Name = "groupBox6";
  767. this.groupBox6.Size = new System.Drawing.Size(508, 122);
  768. this.groupBox6.TabIndex = 7;
  769. this.groupBox6.TabStop = false;
  770. this.groupBox6.Text = "预存标注";
  771. //
  772. // listView1
  773. //
  774. this.listView1.FullRowSelect = true;
  775. this.listView1.GridLines = true;
  776. this.listView1.HideSelection = false;
  777. this.listView1.Location = new System.Drawing.Point(0, 37);
  778. this.listView1.MultiSelect = false;
  779. this.listView1.Name = "listView1";
  780. this.listView1.ShowItemToolTips = true;
  781. this.listView1.Size = new System.Drawing.Size(508, 85);
  782. this.listView1.TabIndex = 5;
  783. this.listView1.UseCompatibleStateImageBehavior = false;
  784. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  785. //
  786. // addRulerBtn
  787. //
  788. this.addRulerBtn.Location = new System.Drawing.Point(351, 8);
  789. this.addRulerBtn.Name = "addRulerBtn";
  790. this.addRulerBtn.Size = new System.Drawing.Size(75, 23);
  791. this.addRulerBtn.TabIndex = 4;
  792. this.addRulerBtn.Text = "+";
  793. this.addRulerBtn.UseVisualStyleBackColor = true;
  794. this.addRulerBtn.Click += new System.EventHandler(this.addRulerBtn_Click);
  795. //
  796. // deleteRulerBtn
  797. //
  798. this.deleteRulerBtn.Location = new System.Drawing.Point(427, 8);
  799. this.deleteRulerBtn.Name = "deleteRulerBtn";
  800. this.deleteRulerBtn.Size = new System.Drawing.Size(75, 23);
  801. this.deleteRulerBtn.TabIndex = 2;
  802. this.deleteRulerBtn.Text = "-";
  803. this.deleteRulerBtn.UseVisualStyleBackColor = true;
  804. this.deleteRulerBtn.Click += new System.EventHandler(this.deleteRulerBtn_Click);
  805. //
  806. // RulerSettingDialog
  807. //
  808. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  809. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  810. this.ClientSize = new System.Drawing.Size(533, 646);
  811. this.Controls.Add(this.groupBox6);
  812. this.Controls.Add(this.groupBox5);
  813. this.Controls.Add(this.groupBox4);
  814. this.Controls.Add(this.previewGroupBox);
  815. this.Controls.Add(this.groupBox1);
  816. this.Controls.Add(this.groupBox2);
  817. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  818. this.MaximizeBox = false;
  819. this.MinimizeBox = false;
  820. this.Name = "RulerSettingDialog";
  821. this.ShowIcon = false;
  822. this.Text = "标尺设置";
  823. this.Controls.SetChildIndex(this.groupBox2, 0);
  824. this.Controls.SetChildIndex(this.groupBox1, 0);
  825. this.Controls.SetChildIndex(this.previewGroupBox, 0);
  826. this.Controls.SetChildIndex(this.groupBox4, 0);
  827. this.Controls.SetChildIndex(this.groupBox5, 0);
  828. this.Controls.SetChildIndex(this.groupBox6, 0);
  829. this.groupBox1.ResumeLayout(false);
  830. this.groupBox2.ResumeLayout(false);
  831. this.groupBox2.PerformLayout();
  832. ((System.ComponentModel.ISupportInitialize)(this.textHeightVal)).EndInit();
  833. ((System.ComponentModel.ISupportInitialize)(this.backgroundSizeVal)).EndInit();
  834. ((System.ComponentModel.ISupportInitialize)(this.verticalLineLengthVal)).EndInit();
  835. ((System.ComponentModel.ISupportInitialize)(this.borderWidthVal)).EndInit();
  836. ((System.ComponentModel.ISupportInitialize)(this.lineWidthVal)).EndInit();
  837. ((System.ComponentModel.ISupportInitialize)(this.textFontSizeVal)).EndInit();
  838. this.previewGroupBox.ResumeLayout(false);
  839. this.groupBox4.ResumeLayout(false);
  840. this.groupBox4.PerformLayout();
  841. ((System.ComponentModel.ISupportInitialize)(this.autoRulerValueVal)).EndInit();
  842. this.groupBox5.ResumeLayout(false);
  843. this.groupBox5.PerformLayout();
  844. ((System.ComponentModel.ISupportInitialize)(this.rulerMarginVal)).EndInit();
  845. this.groupBox6.ResumeLayout(false);
  846. this.ResumeLayout(false);
  847. }
  848. #endregion
  849. #region InitializeComponent2
  850. /// <summary>
  851. /// 初始化组件
  852. /// </summary>
  853. private void InitializeComponent2()
  854. {
  855. this.listView1.View = View.Details;
  856. ColumnHeader header = new ColumnHeader();
  857. header.Text = PdnResources.GetString("Menu.name.text");
  858. header.Width = 240;
  859. this.listView1.Columns.Add(header);
  860. header = new ColumnHeader();
  861. header.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text");
  862. header.Width = 240;
  863. this.listView1.Columns.Add(header);
  864. System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
  865. ArrayList fontsItems = new ArrayList();
  866. foreach (FontFamily fontFamily in fonts.Families)
  867. {
  868. fontsItems.Add(fontFamily.Name);
  869. }
  870. this.textFontVal.DataSource = fontsItems;
  871. this.textPositionVal.DataSource = new string[] { PdnResources.GetString("Menu.Set.Rulersettings.Left.text"),
  872. PdnResources.GetString("Menu.nthemiddle.Text")
  873. , PdnResources.GetString("Menu.Set.Rulersettings.Right.text") };
  874. this.textBold.DataSource = new string[] { PdnResources.GetString("Menu.no.text") ,PdnResources.GetString("Menu.Yes.text")};
  875. this.colorsFormFont = new ColorsForm();
  876. this.colorsFormFont.StartPosition = FormStartPosition.CenterScreen;
  877. this.colorsFormFont.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  878. this.colorsFormLine = new ColorsForm();
  879. this.colorsFormLine.StartPosition = FormStartPosition.CenterScreen;
  880. this.colorsFormLine.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  881. this.colorsFormBackground = new ColorsForm();
  882. this.colorsFormBackground.StartPosition = FormStartPosition.CenterScreen;
  883. this.colorsFormBackground.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  884. this.colorsFormBorder = new ColorsForm();
  885. this.colorsFormBorder.StartPosition = FormStartPosition.CenterScreen;
  886. this.colorsFormBorder.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  887. }
  888. #endregion
  889. #region addRulerformInit
  890. /// <summary>
  891. /// 新增预存标注
  892. /// </summary>
  893. private void addRulerformInit()
  894. {
  895. this.addRulerform.StartPosition = FormStartPosition.CenterScreen;
  896. this.addRulerform.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  897. this.addRulerform.FormBorderStyle = FormBorderStyle.FixedSingle;
  898. this.addRulerform.ClientSize = new System.Drawing.Size(330, 105);
  899. this.addRulerform.MaximizeBox = false;
  900. this.addRulerform.MinimizeBox = false;
  901. this.addRulerform.Name = "addRulerDialog";
  902. this.addRulerform.ShowIcon = false;
  903. this.addRulerform.Text = PdnResources.GetString("Menu.Set.Rulersettings.Newpre-storedannotation.text");
  904. Label nameLabel = new Label();
  905. nameLabel.Location = new System.Drawing.Point(15, 15);
  906. nameLabel.Size = new System.Drawing.Size(45, 12);
  907. nameLabel.Name = "nameLabel";
  908. nameLabel.Text = PdnResources.GetString("Menu.name.text")+":";
  909. this.nameValue.Location = new System.Drawing.Point(60, 11);
  910. this.nameValue.Name = "nameValue";
  911. this.nameValue.Size = new System.Drawing.Size(250, 21);
  912. this.nameValue.TextChanged += new System.EventHandler(this.nameValue_TextChanged);
  913. Label lengthLabel = new Label();
  914. lengthLabel.Location = new System.Drawing.Point(15, 42);
  915. lengthLabel.Size = new System.Drawing.Size(45, 12);
  916. lengthLabel.Name = "lengthLabel";
  917. lengthLabel.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text")+":";
  918. this.lengthVal.Location = new System.Drawing.Point(60, 38);
  919. this.lengthVal.Name = "lengthVal";
  920. this.lengthVal.Size = new System.Drawing.Size(50, 21);
  921. this.lengthVal.ValueChanged += new System.EventHandler(this.lengthVal_ValueChanged);
  922. this.lengthVal.Maximum = 9999999999;
  923. Label descriptionLabel = new Label();
  924. descriptionLabel.Location = new System.Drawing.Point(115, 42);
  925. descriptionLabel.Size = new System.Drawing.Size(230, 12);
  926. descriptionLabel.Name = "descriptionLabel";
  927. descriptionLabel.Text = PdnResources.GetString("Menu.Micronoronethousandthofanin.Text");
  928. Button saveButton = new Button();
  929. saveButton.Location = new System.Drawing.Point(235, 69);
  930. saveButton.Name = "saveButton";
  931. saveButton.Size = new System.Drawing.Size(75, 23);
  932. saveButton.Text = PdnResources.GetString("Menu.File.Save.Text");
  933. saveButton.UseVisualStyleBackColor = true;
  934. saveButton.Click += new System.EventHandler(this.saveButton_Click);
  935. this.addRulerform.Controls.Add(nameLabel);
  936. this.addRulerform.Controls.Add(nameValue);
  937. this.addRulerform.Controls.Add(lengthLabel);
  938. this.addRulerform.Controls.Add(lengthVal);
  939. this.addRulerform.Controls.Add(descriptionLabel);
  940. this.addRulerform.Controls.Add(saveButton);
  941. }
  942. #endregion
  943. #endregion
  944. #region 事件
  945. #region 主要窗体事件
  946. private void saveBtn_Click(object sender, EventArgs e)
  947. {
  948. string stageModelXml = XmlSerializeHelper.XmlSerialize<RulerModel>(this.rulerModel);
  949. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Ruler.xml";
  950. if (FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create))
  951. {
  952. Startup.instance.rulerModel = this.rulerModel;
  953. this.Close();
  954. }
  955. else
  956. {
  957. MessageBox.Show(PdnResources.GetString("Menu.Rulerinformationsavingfaile.Text"));
  958. }
  959. }
  960. private void cancelBtn_Click(object sender, EventArgs e)
  961. {
  962. this.Close();
  963. }
  964. private void textFontSizeVal_ValueChanged(object sender, EventArgs e)
  965. {
  966. this.rulerModel.textFontSize = this.textFontSizeVal.Value;
  967. this.previewPanel.Invalidate();
  968. }
  969. private void textFontVal_SelectedIndexChanged(object sender, EventArgs e)
  970. {
  971. this.rulerModel.textFont = this.textFontVal.Text;
  972. this.previewPanel.Invalidate();
  973. }
  974. private void textColorPanel_Click(object sender, EventArgs e)
  975. {
  976. this.colorsFormFont.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.textColor));
  977. this.colorsFormFont.setSaveBtn_Click(new System.EventHandler(this.textColorChanged));
  978. this.colorsFormFont.ShowDialog();
  979. }
  980. private void textPositionVal_SelectedIndexChanged(object sender, EventArgs e)
  981. {
  982. this.rulerModel.textPosition = this.textPositionVal.SelectedIndex;
  983. this.previewPanel.Invalidate();
  984. }
  985. private void textBold_SelectedIndexChanged(object sender, EventArgs e)
  986. {
  987. this.rulerModel.textBold = this.textBold.SelectedIndex;
  988. this.previewPanel.Invalidate();
  989. }
  990. private void lineColorPanel_Click(object sender, EventArgs e)
  991. {
  992. this.colorsFormLine.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.lineColor));
  993. this.colorsFormLine.setSaveBtn_Click(new System.EventHandler(this.lineColorChanged));
  994. this.colorsFormLine.ShowDialog();
  995. }
  996. private void lineWidthVal_ValueChanged(object sender, EventArgs e)
  997. {
  998. this.rulerModel.lineWidth = this.lineWidthVal.Value;
  999. this.previewPanel.Invalidate();
  1000. }
  1001. private void verticalLineLengthVal_ValueChanged(object sender, EventArgs e)
  1002. {
  1003. this.rulerModel.verticalLineLength = this.verticalLineLengthVal.Value;
  1004. this.previewPanel.Invalidate();
  1005. }
  1006. private void textHeightVal_ValueChanged(object sender, EventArgs e)
  1007. {
  1008. this.rulerModel.textHeight = this.textHeightVal.Value;
  1009. this.previewPanel.Invalidate();
  1010. }
  1011. private void backColorPanel_Click(object sender, EventArgs e)
  1012. {
  1013. this.colorsFormBackground.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.backColor));
  1014. this.colorsFormBackground.setSaveBtn_Click(new System.EventHandler(this.backColorChanged));
  1015. this.colorsFormBackground.ShowDialog();
  1016. }
  1017. private void backgroundSizeVal_ValueChanged(object sender, EventArgs e)
  1018. {
  1019. this.rulerModel.backgroundSize = this.backgroundSizeVal.Value;
  1020. this.previewPanel.Invalidate();
  1021. }
  1022. private void borderColorValPanel_Click(object sender, EventArgs e)
  1023. {
  1024. this.colorsFormBorder.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.borderColor));
  1025. this.colorsFormBorder.setSaveBtn_Click(new System.EventHandler(this.borderColorChanged));
  1026. this.colorsFormBorder.ShowDialog();
  1027. }
  1028. private void borderWidthVal_ValueChanged(object sender, EventArgs e)
  1029. {
  1030. this.rulerModel.borderWidth = this.borderWidthVal.Value;
  1031. this.previewPanel.Invalidate();
  1032. }
  1033. private void autoRulerValueVal_ValueChanged(object sender, EventArgs e)
  1034. {
  1035. this.rulerModel.autoRulerValue = this.autoRulerValueVal.Value;
  1036. }
  1037. private void rulerPositionVal1_CheckedChanged(object sender, EventArgs e)
  1038. {
  1039. this.rulerModel.rulerPosition = 1;
  1040. }
  1041. private void rulerPositionVal2_CheckedChanged(object sender, EventArgs e)
  1042. {
  1043. this.rulerModel.rulerPosition = 2;
  1044. }
  1045. private void rulerPositionVal3_CheckedChanged(object sender, EventArgs e)
  1046. {
  1047. this.rulerModel.rulerPosition = 3;
  1048. }
  1049. private void rulerPositionVal4_CheckedChanged(object sender, EventArgs e)
  1050. {
  1051. this.rulerModel.rulerPosition = 4;
  1052. }
  1053. private void rulerMarginVal_ValueChanged(object sender, EventArgs e)
  1054. {
  1055. this.rulerModel.rulerMargin = this.rulerMarginVal.Value;
  1056. }
  1057. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  1058. {
  1059. }
  1060. private void textColorChanged(object sender, EventArgs e)
  1061. {
  1062. this.textColorPanel.BackColor = this.colorsFormFont.UserPrimaryColor.ToColor();
  1063. this.rulerModel.textColor = this.colorsFormFont.UserPrimaryColor.ToColor().ToArgb();
  1064. this.colorsFormFont.Close();
  1065. this.previewPanel.Invalidate();
  1066. }
  1067. private void lineColorChanged(object sender, EventArgs e)
  1068. {
  1069. this.lineColorPanel.BackColor = this.colorsFormLine.UserPrimaryColor.ToColor();
  1070. this.rulerModel.lineColor = this.colorsFormLine.UserPrimaryColor.ToColor().ToArgb();
  1071. this.colorsFormLine.Close();
  1072. this.previewPanel.Invalidate();
  1073. }
  1074. private void backColorChanged(object sender, EventArgs e)
  1075. {
  1076. this.backColorPanel.BackColor = this.colorsFormBackground.UserPrimaryColor.ToColor();
  1077. this.rulerModel.backColor = this.colorsFormBackground.UserPrimaryColor.ToColor().ToArgb();
  1078. this.colorsFormBackground.Close();
  1079. this.previewPanel.Invalidate();
  1080. }
  1081. private void borderColorChanged(object sender, EventArgs e)
  1082. {
  1083. this.borderColorPanel.BackColor = this.colorsFormBorder.UserPrimaryColor.ToColor();
  1084. this.rulerModel.borderColor = this.colorsFormBorder.UserPrimaryColor.ToColor().ToArgb();
  1085. this.colorsFormBorder.Close();
  1086. this.previewPanel.Invalidate();
  1087. }
  1088. private void previewPanel_Paint(object sender, PaintEventArgs e)
  1089. {
  1090. Point center = new Point(this.previewPanel.Width / 2, this.previewPanel.Height * 3 / 4);
  1091. DrawRulerHelper.drawRuler(this.rulerModel, e.Graphics, center, 200, "100μm", out RectangleF rectangleF);
  1092. }
  1093. private void addRulerBtn_Click(object sender, EventArgs e)
  1094. {
  1095. this.nameValue.Text = null;
  1096. this.lengthVal.Value = 0;
  1097. this.addRulerform.ShowDialog(this);
  1098. }
  1099. private void deleteRulerBtn_Click(object sender, EventArgs e)
  1100. {
  1101. if (this.listView1.SelectedItems.Count <= 0)
  1102. return;
  1103. if (MessageBox.Show(PdnResources.GetString("Menu.eyousureyouwanttodeletetheselectedsaved.Text")+"?", PdnResources.GetString("Menu.Thisdeletioncannotberecovered.text"), MessageBoxButtons.YesNo) == DialogResult.Yes)
  1104. {
  1105. ListViewItem item = this.listView1.SelectedItems[0];
  1106. int indexNum = item.Index;
  1107. bool reSelected = false;
  1108. if (indexNum > 0 && indexNum + 1 != this.listView1.Items.Count)
  1109. reSelected = true;
  1110. this.rulerModel.presetRulers.Remove(this.rulerModel.presetRulers[item.Index]);
  1111. this.buildListView();
  1112. if (reSelected)
  1113. {
  1114. this.listView1.Items[indexNum].Selected = true;
  1115. }
  1116. }
  1117. }
  1118. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  1119. {
  1120. ListViewItem defaultItem = new ListViewItem();
  1121. foreach (ListViewItem listViewItem in this.listView1.Items)
  1122. {
  1123. listViewItem.ForeColor = defaultItem.ForeColor;
  1124. listViewItem.BackColor = defaultItem.BackColor;
  1125. }
  1126. if (this.listView1.SelectedItems.Count <= 0)
  1127. {
  1128. return;
  1129. }
  1130. ListViewItem item = this.listView1.SelectedItems[0];
  1131. item.ForeColor = Color.White;
  1132. item.BackColor = Color.FromArgb(0, 120, 215);
  1133. }
  1134. #endregion
  1135. #region 新增预存标注窗体事件
  1136. private void nameValue_TextChanged(object sender, EventArgs e)
  1137. {
  1138. this.tempPresetRuler.name = ((TextBox)sender).Text;
  1139. }
  1140. private void lengthVal_ValueChanged(object sender, EventArgs e)
  1141. {
  1142. this.tempPresetRuler.length = ((NumericUpDown)sender).Value;
  1143. }
  1144. private void saveButton_Click(object sender, EventArgs e)
  1145. {
  1146. if (String.IsNullOrEmpty(this.tempPresetRuler.name))
  1147. {
  1148. MessageBox.Show(PdnResources.GetString("Menu.Pleasefillinthename.Text"));
  1149. return;
  1150. }
  1151. this.rulerModel.presetRulers.Add(this.tempPresetRuler);
  1152. this.tempPresetRuler = new PresetRuler();
  1153. buildListView();
  1154. this.addRulerform.Close();
  1155. }
  1156. #endregion
  1157. #endregion
  1158. #region 读取数据
  1159. /// <summary>
  1160. /// 读取数据
  1161. /// </summary>
  1162. private void readData()
  1163. {
  1164. //this.rulerModel = Startup.instance.rulerModel;//原有获取方式改变设置项后标尺样式即时刷新
  1165. this.rulerModel = XmlSerializeHelper.DESerializer<RulerModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Ruler.xml", FileMode.Open));
  1166. this.textFontSizeVal.Value = this.rulerModel.textFontSize;
  1167. this.textFontVal.Text = this.rulerModel.textFont;
  1168. //this.textColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.textColor));
  1169. this.textPositionVal.SelectedIndex = this.rulerModel.textPosition;
  1170. this.textBold.SelectedIndex = this.rulerModel.textBold;
  1171. //this.lineColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.lineColor));
  1172. this.lineWidthVal.Value = this.rulerModel.lineWidth;
  1173. this.verticalLineLengthVal.Value = this.rulerModel.verticalLineLength;
  1174. this.textHeightVal.Value = this.rulerModel.textHeight;
  1175. //this.backColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.backColor));
  1176. this.backgroundSizeVal.Value = this.rulerModel.backgroundSize;
  1177. //this.borderColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.borderColor));
  1178. this.borderWidthVal.Value = this.rulerModel.borderWidth;
  1179. this.textColorPanel.BackColor = Color.FromArgb(this.rulerModel.textColor);
  1180. this.lineColorPanel.BackColor = Color.FromArgb(this.rulerModel.lineColor);
  1181. this.backColorPanel.BackColor = Color.FromArgb(this.rulerModel.backColor);
  1182. this.borderColorPanel.BackColor = Color.FromArgb(this.rulerModel.borderColor);
  1183. this.autoRulerValueVal.Value = this.rulerModel.autoRulerValue;
  1184. switch (this.rulerModel.rulerPosition)
  1185. {
  1186. case 1: this.rulerPositionVal1.Checked = true; break;
  1187. case 2: this.rulerPositionVal2.Checked = true; break;
  1188. case 3: this.rulerPositionVal3.Checked = true; break;
  1189. case 4: this.rulerPositionVal4.Checked = true; break;
  1190. }
  1191. this.rulerMarginVal.Value = this.rulerModel.rulerMargin;
  1192. }
  1193. #endregion
  1194. #region 其他
  1195. /// <summary>
  1196. /// 构建ListView数据
  1197. /// </summary>
  1198. private void buildListView()
  1199. {
  1200. this.listView1.Items.Clear();
  1201. this.listView1.BeginUpdate();
  1202. foreach (PresetRuler presetRuler in this.rulerModel.presetRulers)
  1203. {
  1204. ListViewItem lvi = new ListViewItem();
  1205. lvi.Text = presetRuler.name.ToString();
  1206. lvi.SubItems.Add(presetRuler.length.ToString());
  1207. this.listView1.Items.Add(lvi);
  1208. }
  1209. this.listView1.EndUpdate();
  1210. if (this.listView1.Items.Count > 0)
  1211. {
  1212. this.listView1.Items[0].Selected = true;
  1213. }
  1214. }
  1215. #endregion
  1216. }
  1217. }