RulerSettingDialog.cs 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  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.Maximum = new decimal(new int[] {
  402. 49000,
  403. 0,
  404. 0,
  405. 0});
  406. this.textFontSizeVal.Minimum = new decimal(new int[] {
  407. 1,
  408. 0,
  409. 0,
  410. 0});
  411. this.textFontSizeVal.Name = "textFontSizeVal";
  412. this.textFontSizeVal.Size = new System.Drawing.Size(72, 21);
  413. this.textFontSizeVal.TabIndex = 50;
  414. this.textFontSizeVal.Value = new decimal(new int[] {
  415. 1,
  416. 0,
  417. 0,
  418. 0});
  419. this.textFontSizeVal.ValueChanged += new System.EventHandler(this.textFontSizeVal_ValueChanged);
  420. //
  421. // lineColorPanel
  422. //
  423. this.lineColorPanel.BackColor = System.Drawing.SystemColors.Window;
  424. this.lineColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  425. this.lineColorPanel.Location = new System.Drawing.Point(254, 23);
  426. this.lineColorPanel.Name = "lineColorPanel";
  427. this.lineColorPanel.Size = new System.Drawing.Size(72, 21);
  428. this.lineColorPanel.TabIndex = 49;
  429. this.lineColorPanel.Click += new System.EventHandler(this.lineColorPanel_Click);
  430. //
  431. // textColorPanel
  432. //
  433. this.textColorPanel.BackColor = System.Drawing.SystemColors.Window;
  434. this.textColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  435. this.textColorPanel.Location = new System.Drawing.Point(84, 81);
  436. this.textColorPanel.Name = "textColorPanel";
  437. this.textColorPanel.Size = new System.Drawing.Size(72, 21);
  438. this.textColorPanel.TabIndex = 0;
  439. this.textColorPanel.Click += new System.EventHandler(this.textColorPanel_Click);
  440. //
  441. // textPositionVal
  442. //
  443. this.textPositionVal.FormattingEnabled = true;
  444. this.textPositionVal.Location = new System.Drawing.Point(84, 110);
  445. this.textPositionVal.Name = "textPositionVal";
  446. this.textPositionVal.Size = new System.Drawing.Size(72, 20);
  447. this.textPositionVal.TabIndex = 40;
  448. this.textPositionVal.SelectedIndexChanged += new System.EventHandler(this.textPositionVal_SelectedIndexChanged);
  449. //
  450. // label19
  451. //
  452. this.label19.AutoSize = true;
  453. this.label19.Location = new System.Drawing.Point(488, 57);
  454. this.label19.Name = "label19";
  455. this.label19.Size = new System.Drawing.Size(11, 12);
  456. this.label19.TabIndex = 37;
  457. this.label19.Text = "%";
  458. //
  459. // label18
  460. //
  461. this.label18.AutoSize = true;
  462. this.label18.Location = new System.Drawing.Point(314, 114);
  463. this.label18.Name = "label18";
  464. this.label18.Size = new System.Drawing.Size(11, 12);
  465. this.label18.TabIndex = 35;
  466. this.label18.Text = "%";
  467. //
  468. // label17
  469. //
  470. this.label17.AutoSize = true;
  471. this.label17.Location = new System.Drawing.Point(315, 85);
  472. this.label17.Name = "label17";
  473. this.label17.Size = new System.Drawing.Size(11, 12);
  474. this.label17.TabIndex = 32;
  475. this.label17.Text = "%";
  476. //
  477. // textFontVal
  478. //
  479. this.textFontVal.FormattingEnabled = true;
  480. this.textFontVal.Location = new System.Drawing.Point(84, 53);
  481. this.textFontVal.Name = "textFontVal";
  482. this.textFontVal.Size = new System.Drawing.Size(72, 20);
  483. this.textFontVal.TabIndex = 0;
  484. this.textFontVal.SelectedIndexChanged += new System.EventHandler(this.textFontVal_SelectedIndexChanged);
  485. //
  486. // label12
  487. //
  488. this.label12.AutoSize = true;
  489. this.label12.Location = new System.Drawing.Point(349, 114);
  490. this.label12.Name = "label12";
  491. this.label12.Size = new System.Drawing.Size(65, 12);
  492. this.label12.TabIndex = 33;
  493. this.label12.Text = "边框线宽:";
  494. //
  495. // label8
  496. //
  497. this.label8.AutoSize = true;
  498. this.label8.Location = new System.Drawing.Point(182, 114);
  499. this.label8.Name = "label8";
  500. this.label8.Size = new System.Drawing.Size(65, 12);
  501. this.label8.TabIndex = 33;
  502. this.label8.Text = "文字高度:";
  503. //
  504. // label4
  505. //
  506. this.label4.AutoSize = true;
  507. this.label4.Location = new System.Drawing.Point(15, 114);
  508. this.label4.Name = "label4";
  509. this.label4.Size = new System.Drawing.Size(65, 12);
  510. this.label4.TabIndex = 33;
  511. this.label4.Text = "文字位置:";
  512. //
  513. // label11
  514. //
  515. this.label11.AutoSize = true;
  516. this.label11.Location = new System.Drawing.Point(349, 27);
  517. this.label11.Name = "label11";
  518. this.label11.Size = new System.Drawing.Size(65, 12);
  519. this.label11.TabIndex = 27;
  520. this.label11.Text = "背景颜色:";
  521. //
  522. // label10
  523. //
  524. this.label10.AutoSize = true;
  525. this.label10.Location = new System.Drawing.Point(349, 85);
  526. this.label10.Name = "label10";
  527. this.label10.Size = new System.Drawing.Size(65, 12);
  528. this.label10.TabIndex = 31;
  529. this.label10.Text = "边框颜色:";
  530. //
  531. // label3
  532. //
  533. this.label3.AutoSize = true;
  534. this.label3.Location = new System.Drawing.Point(182, 27);
  535. this.label3.Name = "label3";
  536. this.label3.Size = new System.Drawing.Size(65, 12);
  537. this.label3.TabIndex = 27;
  538. this.label3.Text = "线条颜色:";
  539. //
  540. // label2
  541. //
  542. this.label2.AutoSize = true;
  543. this.label2.Location = new System.Drawing.Point(182, 85);
  544. this.label2.Name = "label2";
  545. this.label2.Size = new System.Drawing.Size(65, 12);
  546. this.label2.TabIndex = 31;
  547. this.label2.Text = "垂线长度:";
  548. //
  549. // label9
  550. //
  551. this.label9.AutoSize = true;
  552. this.label9.Location = new System.Drawing.Point(349, 57);
  553. this.label9.Name = "label9";
  554. this.label9.Size = new System.Drawing.Size(65, 12);
  555. this.label9.TabIndex = 29;
  556. this.label9.Text = "背景大小:";
  557. //
  558. // label7
  559. //
  560. this.label7.AutoSize = true;
  561. this.label7.Location = new System.Drawing.Point(15, 27);
  562. this.label7.Name = "label7";
  563. this.label7.Size = new System.Drawing.Size(65, 12);
  564. this.label7.TabIndex = 27;
  565. this.label7.Text = "文字字号:";
  566. //
  567. // label1
  568. //
  569. this.label1.AutoSize = true;
  570. this.label1.Location = new System.Drawing.Point(182, 57);
  571. this.label1.Name = "label1";
  572. this.label1.Size = new System.Drawing.Size(65, 12);
  573. this.label1.TabIndex = 29;
  574. this.label1.Text = "线条宽度:";
  575. //
  576. // label5
  577. //
  578. this.label5.AutoSize = true;
  579. this.label5.Location = new System.Drawing.Point(15, 85);
  580. this.label5.Name = "label5";
  581. this.label5.Size = new System.Drawing.Size(65, 12);
  582. this.label5.TabIndex = 31;
  583. this.label5.Text = "文字颜色:";
  584. //
  585. // label6
  586. //
  587. this.label6.AutoSize = true;
  588. this.label6.Location = new System.Drawing.Point(15, 57);
  589. this.label6.Name = "label6";
  590. this.label6.Size = new System.Drawing.Size(65, 12);
  591. this.label6.TabIndex = 29;
  592. this.label6.Text = "文字字体:";
  593. //
  594. // previewGroupBox
  595. //
  596. this.previewGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  597. | System.Windows.Forms.AnchorStyles.Right)));
  598. this.previewGroupBox.Controls.Add(this.previewPanel);
  599. this.previewGroupBox.Location = new System.Drawing.Point(13, 246);
  600. this.previewGroupBox.Name = "previewGroupBox";
  601. this.previewGroupBox.Size = new System.Drawing.Size(508, 180);
  602. this.previewGroupBox.TabIndex = 4;
  603. this.previewGroupBox.TabStop = false;
  604. this.previewGroupBox.Text = "预览";
  605. //
  606. // previewPanel
  607. //
  608. this.previewPanel.Location = new System.Drawing.Point(7, 12);
  609. this.previewPanel.Name = "previewPanel";
  610. this.previewPanel.Size = new System.Drawing.Size(495, 153);
  611. this.previewPanel.TabIndex = 0;
  612. this.previewPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.previewPanel_Paint);
  613. //
  614. // groupBox4
  615. //
  616. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  617. | System.Windows.Forms.AnchorStyles.Right)));
  618. this.groupBox4.Controls.Add(this.autoRulerValueVal);
  619. this.groupBox4.Controls.Add(this.label14);
  620. this.groupBox4.Controls.Add(this.label13);
  621. this.groupBox4.Location = new System.Drawing.Point(13, 417);
  622. this.groupBox4.Name = "groupBox4";
  623. this.groupBox4.Size = new System.Drawing.Size(246, 90);
  624. this.groupBox4.TabIndex = 5;
  625. this.groupBox4.TabStop = false;
  626. this.groupBox4.Text = "自动标注";
  627. //
  628. // autoRulerValueVal
  629. //
  630. this.autoRulerValueVal.Location = new System.Drawing.Point(110, 37);
  631. this.autoRulerValueVal.Maximum = new decimal(new int[] {
  632. 1410065407,
  633. 2,
  634. 0,
  635. 0});
  636. this.autoRulerValueVal.Name = "autoRulerValueVal";
  637. this.autoRulerValueVal.Size = new System.Drawing.Size(117, 21);
  638. this.autoRulerValueVal.TabIndex = 51;
  639. this.autoRulerValueVal.ValueChanged += new System.EventHandler(this.autoRulerValueVal_ValueChanged);
  640. //
  641. // label14
  642. //
  643. this.label14.AutoSize = true;
  644. this.label14.Location = new System.Drawing.Point(150, 61);
  645. this.label14.Name = "label14";
  646. this.label14.Size = new System.Drawing.Size(77, 12);
  647. this.label14.TabIndex = 37;
  648. this.label14.Text = "除以放大倍数";
  649. //
  650. // label13
  651. //
  652. this.label13.AutoSize = true;
  653. this.label13.Location = new System.Drawing.Point(15, 41);
  654. this.label13.Name = "label13";
  655. this.label13.Size = new System.Drawing.Size(89, 12);
  656. this.label13.TabIndex = 35;
  657. this.label13.Text = "自动长度计算:";
  658. //
  659. // groupBox5
  660. //
  661. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  662. | System.Windows.Forms.AnchorStyles.Right)));
  663. this.groupBox5.Controls.Add(this.rulerMarginVal);
  664. this.groupBox5.Controls.Add(this.label20);
  665. this.groupBox5.Controls.Add(this.label16);
  666. this.groupBox5.Controls.Add(this.rulerPositionVal2);
  667. this.groupBox5.Controls.Add(this.rulerPositionVal4);
  668. this.groupBox5.Controls.Add(this.rulerPositionVal3);
  669. this.groupBox5.Controls.Add(this.rulerPositionVal1);
  670. this.groupBox5.Controls.Add(this.label15);
  671. this.groupBox5.Location = new System.Drawing.Point(269, 417);
  672. this.groupBox5.Name = "groupBox5";
  673. this.groupBox5.Size = new System.Drawing.Size(252, 90);
  674. this.groupBox5.TabIndex = 6;
  675. this.groupBox5.TabStop = false;
  676. this.groupBox5.Text = "标尺位置";
  677. //
  678. // rulerMarginVal
  679. //
  680. this.rulerMarginVal.DecimalPlaces = 2;
  681. this.rulerMarginVal.Location = new System.Drawing.Point(77, 57);
  682. this.rulerMarginVal.Name = "rulerMarginVal";
  683. this.rulerMarginVal.Size = new System.Drawing.Size(132, 21);
  684. this.rulerMarginVal.TabIndex = 52;
  685. this.rulerMarginVal.ValueChanged += new System.EventHandler(this.rulerMarginVal_ValueChanged);
  686. //
  687. // label20
  688. //
  689. this.label20.AutoSize = true;
  690. this.label20.Location = new System.Drawing.Point(215, 61);
  691. this.label20.Name = "label20";
  692. this.label20.Size = new System.Drawing.Size(11, 12);
  693. this.label20.TabIndex = 51;
  694. this.label20.Text = "%";
  695. //
  696. // label16
  697. //
  698. this.label16.AutoSize = true;
  699. this.label16.Location = new System.Drawing.Point(6, 61);
  700. this.label16.Name = "label16";
  701. this.label16.Size = new System.Drawing.Size(65, 12);
  702. this.label16.TabIndex = 43;
  703. this.label16.Text = "标注边距:";
  704. //
  705. // rulerPositionVal2
  706. //
  707. this.rulerPositionVal2.AutoSize = true;
  708. this.rulerPositionVal2.Location = new System.Drawing.Point(155, 13);
  709. this.rulerPositionVal2.Name = "rulerPositionVal2";
  710. this.rulerPositionVal2.Size = new System.Drawing.Size(47, 16);
  711. this.rulerPositionVal2.TabIndex = 42;
  712. this.rulerPositionVal2.TabStop = true;
  713. this.rulerPositionVal2.Text = "右上";
  714. this.rulerPositionVal2.UseVisualStyleBackColor = true;
  715. this.rulerPositionVal2.CheckedChanged += new System.EventHandler(this.rulerPositionVal2_CheckedChanged);
  716. //
  717. // rulerPositionVal4
  718. //
  719. this.rulerPositionVal4.AutoSize = true;
  720. this.rulerPositionVal4.Location = new System.Drawing.Point(155, 35);
  721. this.rulerPositionVal4.Name = "rulerPositionVal4";
  722. this.rulerPositionVal4.Size = new System.Drawing.Size(47, 16);
  723. this.rulerPositionVal4.TabIndex = 41;
  724. this.rulerPositionVal4.TabStop = true;
  725. this.rulerPositionVal4.Text = "右下";
  726. this.rulerPositionVal4.UseVisualStyleBackColor = true;
  727. this.rulerPositionVal4.CheckedChanged += new System.EventHandler(this.rulerPositionVal4_CheckedChanged);
  728. //
  729. // rulerPositionVal3
  730. //
  731. this.rulerPositionVal3.AutoSize = true;
  732. this.rulerPositionVal3.Location = new System.Drawing.Point(100, 35);
  733. this.rulerPositionVal3.Name = "rulerPositionVal3";
  734. this.rulerPositionVal3.Size = new System.Drawing.Size(47, 16);
  735. this.rulerPositionVal3.TabIndex = 40;
  736. this.rulerPositionVal3.TabStop = true;
  737. this.rulerPositionVal3.Text = "左下";
  738. this.rulerPositionVal3.UseVisualStyleBackColor = true;
  739. this.rulerPositionVal3.CheckedChanged += new System.EventHandler(this.rulerPositionVal3_CheckedChanged);
  740. //
  741. // rulerPositionVal1
  742. //
  743. this.rulerPositionVal1.AutoSize = true;
  744. this.rulerPositionVal1.Checked = true;
  745. this.rulerPositionVal1.Location = new System.Drawing.Point(100, 13);
  746. this.rulerPositionVal1.Name = "rulerPositionVal1";
  747. this.rulerPositionVal1.Size = new System.Drawing.Size(47, 16);
  748. this.rulerPositionVal1.TabIndex = 39;
  749. this.rulerPositionVal1.TabStop = true;
  750. this.rulerPositionVal1.Text = "左上";
  751. this.rulerPositionVal1.UseVisualStyleBackColor = true;
  752. this.rulerPositionVal1.CheckedChanged += new System.EventHandler(this.rulerPositionVal1_CheckedChanged);
  753. //
  754. // label15
  755. //
  756. this.label15.AutoSize = true;
  757. this.label15.Location = new System.Drawing.Point(6, 26);
  758. this.label15.Name = "label15";
  759. this.label15.Size = new System.Drawing.Size(65, 12);
  760. this.label15.TabIndex = 38;
  761. this.label15.Text = "标尺位置:";
  762. //
  763. // groupBox6
  764. //
  765. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  766. | System.Windows.Forms.AnchorStyles.Right)));
  767. this.groupBox6.Controls.Add(this.listView1);
  768. this.groupBox6.Controls.Add(this.addRulerBtn);
  769. this.groupBox6.Controls.Add(this.deleteRulerBtn);
  770. this.groupBox6.Location = new System.Drawing.Point(13, 513);
  771. this.groupBox6.Name = "groupBox6";
  772. this.groupBox6.Size = new System.Drawing.Size(508, 122);
  773. this.groupBox6.TabIndex = 7;
  774. this.groupBox6.TabStop = false;
  775. this.groupBox6.Text = "预存标注";
  776. //
  777. // listView1
  778. //
  779. this.listView1.FullRowSelect = true;
  780. this.listView1.GridLines = true;
  781. this.listView1.HideSelection = false;
  782. this.listView1.Location = new System.Drawing.Point(0, 37);
  783. this.listView1.MultiSelect = false;
  784. this.listView1.Name = "listView1";
  785. this.listView1.ShowItemToolTips = true;
  786. this.listView1.Size = new System.Drawing.Size(508, 85);
  787. this.listView1.TabIndex = 5;
  788. this.listView1.UseCompatibleStateImageBehavior = false;
  789. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  790. //
  791. // addRulerBtn
  792. //
  793. this.addRulerBtn.Location = new System.Drawing.Point(351, 8);
  794. this.addRulerBtn.Name = "addRulerBtn";
  795. this.addRulerBtn.Size = new System.Drawing.Size(75, 23);
  796. this.addRulerBtn.TabIndex = 4;
  797. this.addRulerBtn.Text = "+";
  798. this.addRulerBtn.UseVisualStyleBackColor = true;
  799. this.addRulerBtn.Click += new System.EventHandler(this.addRulerBtn_Click);
  800. //
  801. // deleteRulerBtn
  802. //
  803. this.deleteRulerBtn.Location = new System.Drawing.Point(427, 8);
  804. this.deleteRulerBtn.Name = "deleteRulerBtn";
  805. this.deleteRulerBtn.Size = new System.Drawing.Size(75, 23);
  806. this.deleteRulerBtn.TabIndex = 2;
  807. this.deleteRulerBtn.Text = "-";
  808. this.deleteRulerBtn.UseVisualStyleBackColor = true;
  809. this.deleteRulerBtn.Click += new System.EventHandler(this.deleteRulerBtn_Click);
  810. //
  811. // RulerSettingDialog
  812. //
  813. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  814. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  815. this.ClientSize = new System.Drawing.Size(533, 646);
  816. this.Controls.Add(this.groupBox6);
  817. this.Controls.Add(this.groupBox5);
  818. this.Controls.Add(this.groupBox4);
  819. this.Controls.Add(this.previewGroupBox);
  820. this.Controls.Add(this.groupBox1);
  821. this.Controls.Add(this.groupBox2);
  822. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  823. this.MaximizeBox = false;
  824. this.MinimizeBox = false;
  825. this.Name = "RulerSettingDialog";
  826. this.ShowIcon = false;
  827. this.Text = "标尺设置";
  828. this.Controls.SetChildIndex(this.groupBox2, 0);
  829. this.Controls.SetChildIndex(this.groupBox1, 0);
  830. this.Controls.SetChildIndex(this.previewGroupBox, 0);
  831. this.Controls.SetChildIndex(this.groupBox4, 0);
  832. this.Controls.SetChildIndex(this.groupBox5, 0);
  833. this.Controls.SetChildIndex(this.groupBox6, 0);
  834. this.groupBox1.ResumeLayout(false);
  835. this.groupBox2.ResumeLayout(false);
  836. this.groupBox2.PerformLayout();
  837. ((System.ComponentModel.ISupportInitialize)(this.textHeightVal)).EndInit();
  838. ((System.ComponentModel.ISupportInitialize)(this.backgroundSizeVal)).EndInit();
  839. ((System.ComponentModel.ISupportInitialize)(this.verticalLineLengthVal)).EndInit();
  840. ((System.ComponentModel.ISupportInitialize)(this.borderWidthVal)).EndInit();
  841. ((System.ComponentModel.ISupportInitialize)(this.lineWidthVal)).EndInit();
  842. ((System.ComponentModel.ISupportInitialize)(this.textFontSizeVal)).EndInit();
  843. this.previewGroupBox.ResumeLayout(false);
  844. this.groupBox4.ResumeLayout(false);
  845. this.groupBox4.PerformLayout();
  846. ((System.ComponentModel.ISupportInitialize)(this.autoRulerValueVal)).EndInit();
  847. this.groupBox5.ResumeLayout(false);
  848. this.groupBox5.PerformLayout();
  849. ((System.ComponentModel.ISupportInitialize)(this.rulerMarginVal)).EndInit();
  850. this.groupBox6.ResumeLayout(false);
  851. this.ResumeLayout(false);
  852. }
  853. #endregion
  854. #region InitializeComponent2
  855. /// <summary>
  856. /// 初始化组件
  857. /// </summary>
  858. private void InitializeComponent2()
  859. {
  860. this.listView1.View = View.Details;
  861. ColumnHeader header = new ColumnHeader();
  862. header.Text = PdnResources.GetString("Menu.name.text");
  863. header.Width = 240;
  864. this.listView1.Columns.Add(header);
  865. header = new ColumnHeader();
  866. header.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text");
  867. header.Width = 240;
  868. this.listView1.Columns.Add(header);
  869. System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
  870. ArrayList fontsItems = new ArrayList();
  871. foreach (FontFamily fontFamily in fonts.Families)
  872. {
  873. fontsItems.Add(fontFamily.Name);
  874. }
  875. this.textFontVal.DataSource = fontsItems;
  876. this.textPositionVal.DataSource = new string[] { PdnResources.GetString("Menu.Set.Rulersettings.Left.text"),
  877. PdnResources.GetString("Menu.nthemiddle.Text")
  878. , PdnResources.GetString("Menu.Set.Rulersettings.Right.text") };
  879. this.textBold.DataSource = new string[] { PdnResources.GetString("Menu.no.text") ,PdnResources.GetString("Menu.Yes.text")};
  880. this.colorsFormFont = new ColorsForm();
  881. this.colorsFormFont.StartPosition = FormStartPosition.CenterScreen;
  882. this.colorsFormFont.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  883. this.colorsFormLine = new ColorsForm();
  884. this.colorsFormLine.StartPosition = FormStartPosition.CenterScreen;
  885. this.colorsFormLine.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  886. this.colorsFormBackground = new ColorsForm();
  887. this.colorsFormBackground.StartPosition = FormStartPosition.CenterScreen;
  888. this.colorsFormBackground.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  889. this.colorsFormBorder = new ColorsForm();
  890. this.colorsFormBorder.StartPosition = FormStartPosition.CenterScreen;
  891. this.colorsFormBorder.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  892. }
  893. #endregion
  894. #region addRulerformInit
  895. /// <summary>
  896. /// 新增预存标注
  897. /// </summary>
  898. private void addRulerformInit()
  899. {
  900. this.addRulerform.StartPosition = FormStartPosition.CenterScreen;
  901. this.addRulerform.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  902. this.addRulerform.FormBorderStyle = FormBorderStyle.FixedSingle;
  903. this.addRulerform.ClientSize = new System.Drawing.Size(330, 105);
  904. this.addRulerform.MaximizeBox = false;
  905. this.addRulerform.MinimizeBox = false;
  906. this.addRulerform.Name = "addRulerDialog";
  907. this.addRulerform.ShowIcon = false;
  908. this.addRulerform.Text = PdnResources.GetString("Menu.Set.Rulersettings.Newpre-storedannotation.text");
  909. Label nameLabel = new Label();
  910. nameLabel.Location = new System.Drawing.Point(15, 15);
  911. nameLabel.Size = new System.Drawing.Size(45, 12);
  912. nameLabel.Name = "nameLabel";
  913. nameLabel.Text = PdnResources.GetString("Menu.name.text")+":";
  914. this.nameValue.Location = new System.Drawing.Point(60, 11);
  915. this.nameValue.Name = "nameValue";
  916. this.nameValue.Size = new System.Drawing.Size(250, 21);
  917. this.nameValue.TextChanged += new System.EventHandler(this.nameValue_TextChanged);
  918. Label lengthLabel = new Label();
  919. lengthLabel.Location = new System.Drawing.Point(15, 42);
  920. lengthLabel.Size = new System.Drawing.Size(45, 12);
  921. lengthLabel.Name = "lengthLabel";
  922. lengthLabel.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text")+":";
  923. this.lengthVal.Location = new System.Drawing.Point(60, 38);
  924. this.lengthVal.Name = "lengthVal";
  925. this.lengthVal.Size = new System.Drawing.Size(50, 21);
  926. this.lengthVal.ValueChanged += new System.EventHandler(this.lengthVal_ValueChanged);
  927. this.lengthVal.Maximum = 9999999999;
  928. Label descriptionLabel = new Label();
  929. descriptionLabel.Location = new System.Drawing.Point(115, 42);
  930. descriptionLabel.Size = new System.Drawing.Size(230, 12);
  931. descriptionLabel.Name = "descriptionLabel";
  932. descriptionLabel.Text = PdnResources.GetString("Menu.Micronoronethousandthofanin.Text");
  933. Button saveButton = new Button();
  934. saveButton.Location = new System.Drawing.Point(235, 69);
  935. saveButton.Name = "saveButton";
  936. saveButton.Size = new System.Drawing.Size(75, 23);
  937. saveButton.Text = PdnResources.GetString("Menu.File.Save.Text");
  938. saveButton.UseVisualStyleBackColor = true;
  939. saveButton.Click += new System.EventHandler(this.saveButton_Click);
  940. this.addRulerform.Controls.Add(nameLabel);
  941. this.addRulerform.Controls.Add(nameValue);
  942. this.addRulerform.Controls.Add(lengthLabel);
  943. this.addRulerform.Controls.Add(lengthVal);
  944. this.addRulerform.Controls.Add(descriptionLabel);
  945. this.addRulerform.Controls.Add(saveButton);
  946. }
  947. #endregion
  948. #endregion
  949. #region 事件
  950. #region 主要窗体事件
  951. private void saveBtn_Click(object sender, EventArgs e)
  952. {
  953. string stageModelXml = XmlSerializeHelper.XmlSerialize<RulerModel>(this.rulerModel);
  954. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Ruler.xml";
  955. if (FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create))
  956. {
  957. Startup.instance.rulerModel = this.rulerModel;
  958. this.Close();
  959. }
  960. else
  961. {
  962. MessageBox.Show(PdnResources.GetString("Menu.Rulerinformationsavingfaile.Text"));
  963. }
  964. }
  965. private void cancelBtn_Click(object sender, EventArgs e)
  966. {
  967. this.Close();
  968. }
  969. private void textFontSizeVal_ValueChanged(object sender, EventArgs e)
  970. {
  971. this.rulerModel.textFontSize = this.textFontSizeVal.Value;
  972. this.previewPanel.Invalidate();
  973. }
  974. private void textFontVal_SelectedIndexChanged(object sender, EventArgs e)
  975. {
  976. this.rulerModel.textFont = this.textFontVal.Text;
  977. this.previewPanel.Invalidate();
  978. }
  979. private void textColorPanel_Click(object sender, EventArgs e)
  980. {
  981. this.colorsFormFont.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.textColor));
  982. this.colorsFormFont.setSaveBtn_Click(new System.EventHandler(this.textColorChanged));
  983. this.colorsFormFont.ShowDialog();
  984. }
  985. private void textPositionVal_SelectedIndexChanged(object sender, EventArgs e)
  986. {
  987. this.rulerModel.textPosition = this.textPositionVal.SelectedIndex;
  988. this.previewPanel.Invalidate();
  989. }
  990. private void textBold_SelectedIndexChanged(object sender, EventArgs e)
  991. {
  992. this.rulerModel.textBold = this.textBold.SelectedIndex;
  993. this.previewPanel.Invalidate();
  994. }
  995. private void lineColorPanel_Click(object sender, EventArgs e)
  996. {
  997. this.colorsFormLine.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.lineColor));
  998. this.colorsFormLine.setSaveBtn_Click(new System.EventHandler(this.lineColorChanged));
  999. this.colorsFormLine.ShowDialog();
  1000. }
  1001. private void lineWidthVal_ValueChanged(object sender, EventArgs e)
  1002. {
  1003. this.rulerModel.lineWidth = this.lineWidthVal.Value;
  1004. this.previewPanel.Invalidate();
  1005. }
  1006. private void verticalLineLengthVal_ValueChanged(object sender, EventArgs e)
  1007. {
  1008. this.rulerModel.verticalLineLength = this.verticalLineLengthVal.Value;
  1009. this.previewPanel.Invalidate();
  1010. }
  1011. private void textHeightVal_ValueChanged(object sender, EventArgs e)
  1012. {
  1013. this.rulerModel.textHeight = this.textHeightVal.Value;
  1014. this.previewPanel.Invalidate();
  1015. }
  1016. private void backColorPanel_Click(object sender, EventArgs e)
  1017. {
  1018. this.colorsFormBackground.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.backColor));
  1019. this.colorsFormBackground.setSaveBtn_Click(new System.EventHandler(this.backColorChanged));
  1020. this.colorsFormBackground.ShowDialog();
  1021. }
  1022. private void backgroundSizeVal_ValueChanged(object sender, EventArgs e)
  1023. {
  1024. this.rulerModel.backgroundSize = this.backgroundSizeVal.Value;
  1025. this.previewPanel.Invalidate();
  1026. }
  1027. private void borderColorValPanel_Click(object sender, EventArgs e)
  1028. {
  1029. this.colorsFormBorder.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.borderColor));
  1030. this.colorsFormBorder.setSaveBtn_Click(new System.EventHandler(this.borderColorChanged));
  1031. this.colorsFormBorder.ShowDialog();
  1032. }
  1033. private void borderWidthVal_ValueChanged(object sender, EventArgs e)
  1034. {
  1035. this.rulerModel.borderWidth = this.borderWidthVal.Value;
  1036. this.previewPanel.Invalidate();
  1037. }
  1038. private void autoRulerValueVal_ValueChanged(object sender, EventArgs e)
  1039. {
  1040. this.rulerModel.autoRulerValue = this.autoRulerValueVal.Value;
  1041. }
  1042. private void rulerPositionVal1_CheckedChanged(object sender, EventArgs e)
  1043. {
  1044. this.rulerModel.rulerPosition = 1;
  1045. }
  1046. private void rulerPositionVal2_CheckedChanged(object sender, EventArgs e)
  1047. {
  1048. this.rulerModel.rulerPosition = 2;
  1049. }
  1050. private void rulerPositionVal3_CheckedChanged(object sender, EventArgs e)
  1051. {
  1052. this.rulerModel.rulerPosition = 3;
  1053. }
  1054. private void rulerPositionVal4_CheckedChanged(object sender, EventArgs e)
  1055. {
  1056. this.rulerModel.rulerPosition = 4;
  1057. }
  1058. private void rulerMarginVal_ValueChanged(object sender, EventArgs e)
  1059. {
  1060. this.rulerModel.rulerMargin = this.rulerMarginVal.Value;
  1061. }
  1062. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  1063. {
  1064. }
  1065. private void textColorChanged(object sender, EventArgs e)
  1066. {
  1067. this.textColorPanel.BackColor = this.colorsFormFont.UserPrimaryColor.ToColor();
  1068. this.rulerModel.textColor = this.colorsFormFont.UserPrimaryColor.ToColor().ToArgb();
  1069. this.colorsFormFont.Close();
  1070. this.previewPanel.Invalidate();
  1071. }
  1072. private void lineColorChanged(object sender, EventArgs e)
  1073. {
  1074. this.lineColorPanel.BackColor = this.colorsFormLine.UserPrimaryColor.ToColor();
  1075. this.rulerModel.lineColor = this.colorsFormLine.UserPrimaryColor.ToColor().ToArgb();
  1076. this.colorsFormLine.Close();
  1077. this.previewPanel.Invalidate();
  1078. }
  1079. private void backColorChanged(object sender, EventArgs e)
  1080. {
  1081. this.backColorPanel.BackColor = this.colorsFormBackground.UserPrimaryColor.ToColor();
  1082. this.rulerModel.backColor = this.colorsFormBackground.UserPrimaryColor.ToColor().ToArgb();
  1083. this.colorsFormBackground.Close();
  1084. this.previewPanel.Invalidate();
  1085. }
  1086. private void borderColorChanged(object sender, EventArgs e)
  1087. {
  1088. this.borderColorPanel.BackColor = this.colorsFormBorder.UserPrimaryColor.ToColor();
  1089. this.rulerModel.borderColor = this.colorsFormBorder.UserPrimaryColor.ToColor().ToArgb();
  1090. this.colorsFormBorder.Close();
  1091. this.previewPanel.Invalidate();
  1092. }
  1093. private void previewPanel_Paint(object sender, PaintEventArgs e)
  1094. {
  1095. Point center = new Point(this.previewPanel.Width / 2, this.previewPanel.Height * 3 / 4);
  1096. DrawRulerHelper.drawRuler(this.rulerModel, e.Graphics, center, 200, "100μm", out RectangleF rectangleF);
  1097. }
  1098. private void addRulerBtn_Click(object sender, EventArgs e)
  1099. {
  1100. this.nameValue.Text = null;
  1101. this.lengthVal.Value = 0;
  1102. this.addRulerform.ShowDialog(this);
  1103. }
  1104. private void deleteRulerBtn_Click(object sender, EventArgs e)
  1105. {
  1106. if (this.listView1.SelectedItems.Count <= 0)
  1107. return;
  1108. if (MessageBox.Show(PdnResources.GetString("Menu.eyousureyouwanttodeletetheselectedsaved.Text")+"?", PdnResources.GetString("Menu.Thisdeletioncannotberecovered.text"), MessageBoxButtons.YesNo) == DialogResult.Yes)
  1109. {
  1110. ListViewItem item = this.listView1.SelectedItems[0];
  1111. int indexNum = item.Index;
  1112. bool reSelected = false;
  1113. if (indexNum > 0 && indexNum + 1 != this.listView1.Items.Count)
  1114. reSelected = true;
  1115. this.rulerModel.presetRulers.Remove(this.rulerModel.presetRulers[item.Index]);
  1116. this.buildListView();
  1117. if (reSelected)
  1118. {
  1119. this.listView1.Items[indexNum].Selected = true;
  1120. }
  1121. }
  1122. }
  1123. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  1124. {
  1125. ListViewItem defaultItem = new ListViewItem();
  1126. foreach (ListViewItem listViewItem in this.listView1.Items)
  1127. {
  1128. listViewItem.ForeColor = defaultItem.ForeColor;
  1129. listViewItem.BackColor = defaultItem.BackColor;
  1130. }
  1131. if (this.listView1.SelectedItems.Count <= 0)
  1132. {
  1133. return;
  1134. }
  1135. ListViewItem item = this.listView1.SelectedItems[0];
  1136. item.ForeColor = Color.White;
  1137. item.BackColor = Color.FromArgb(0, 120, 215);
  1138. }
  1139. #endregion
  1140. #region 新增预存标注窗体事件
  1141. private void nameValue_TextChanged(object sender, EventArgs e)
  1142. {
  1143. this.tempPresetRuler.name = ((TextBox)sender).Text;
  1144. }
  1145. private void lengthVal_ValueChanged(object sender, EventArgs e)
  1146. {
  1147. this.tempPresetRuler.length = ((NumericUpDown)sender).Value;
  1148. }
  1149. private void saveButton_Click(object sender, EventArgs e)
  1150. {
  1151. if (String.IsNullOrEmpty(this.tempPresetRuler.name))
  1152. {
  1153. MessageBox.Show(PdnResources.GetString("Menu.Pleasefillinthename.Text"));
  1154. return;
  1155. }
  1156. this.rulerModel.presetRulers.Add(this.tempPresetRuler);
  1157. this.tempPresetRuler = new PresetRuler();
  1158. buildListView();
  1159. this.addRulerform.Close();
  1160. }
  1161. #endregion
  1162. #endregion
  1163. #region 读取数据
  1164. /// <summary>
  1165. /// 读取数据
  1166. /// </summary>
  1167. private void readData()
  1168. {
  1169. //this.rulerModel = Startup.instance.rulerModel;//原有获取方式改变设置项后标尺样式即时刷新
  1170. this.rulerModel = XmlSerializeHelper.DESerializer<RulerModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Ruler.xml", FileMode.Open));
  1171. this.textFontSizeVal.Value = this.rulerModel.textFontSize;
  1172. this.textFontVal.Text = this.rulerModel.textFont;
  1173. //this.textColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.textColor));
  1174. this.textPositionVal.SelectedIndex = this.rulerModel.textPosition;
  1175. this.textBold.SelectedIndex = this.rulerModel.textBold;
  1176. //this.lineColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.lineColor));
  1177. this.lineWidthVal.Value = this.rulerModel.lineWidth;
  1178. this.verticalLineLengthVal.Value = this.rulerModel.verticalLineLength;
  1179. this.textHeightVal.Value = this.rulerModel.textHeight;
  1180. //this.backColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.backColor));
  1181. this.backgroundSizeVal.Value = this.rulerModel.backgroundSize;
  1182. //this.borderColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.borderColor));
  1183. this.borderWidthVal.Value = this.rulerModel.borderWidth;
  1184. this.textColorPanel.BackColor = Color.FromArgb(this.rulerModel.textColor);
  1185. this.lineColorPanel.BackColor = Color.FromArgb(this.rulerModel.lineColor);
  1186. this.backColorPanel.BackColor = Color.FromArgb(this.rulerModel.backColor);
  1187. this.borderColorPanel.BackColor = Color.FromArgb(this.rulerModel.borderColor);
  1188. this.autoRulerValueVal.Value = this.rulerModel.autoRulerValue;
  1189. switch (this.rulerModel.rulerPosition)
  1190. {
  1191. case 1: this.rulerPositionVal1.Checked = true; break;
  1192. case 2: this.rulerPositionVal2.Checked = true; break;
  1193. case 3: this.rulerPositionVal3.Checked = true; break;
  1194. case 4: this.rulerPositionVal4.Checked = true; break;
  1195. }
  1196. this.rulerMarginVal.Value = this.rulerModel.rulerMargin;
  1197. }
  1198. #endregion
  1199. #region 其他
  1200. /// <summary>
  1201. /// 构建ListView数据
  1202. /// </summary>
  1203. private void buildListView()
  1204. {
  1205. this.listView1.Items.Clear();
  1206. this.listView1.BeginUpdate();
  1207. foreach (PresetRuler presetRuler in this.rulerModel.presetRulers)
  1208. {
  1209. ListViewItem lvi = new ListViewItem();
  1210. lvi.Text = presetRuler.name.ToString();
  1211. lvi.SubItems.Add(presetRuler.length.ToString());
  1212. this.listView1.Items.Add(lvi);
  1213. }
  1214. this.listView1.EndUpdate();
  1215. if (this.listView1.Items.Count > 0)
  1216. {
  1217. this.listView1.Items[0].Selected = true;
  1218. }
  1219. }
  1220. #endregion
  1221. }
  1222. }