LabelSettingDialog.cs 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297
  1. using PaintDotNet.Annotation.Enum;
  2. using PaintDotNet.Annotation.relationModel;
  3. using PaintDotNet.Base.SettingModel;
  4. using PaintDotNet.Base.CommTool;
  5. using PaintDotNet.Setting.LabelComponent;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Drawing;
  9. using System.IO;
  10. using System.Windows.Forms;
  11. using PaintDotNet.Base;
  12. using PaintDotNet.Annotation;
  13. namespace PaintDotNet.Setting
  14. {
  15. /// <summary>
  16. /// 设置->标注设置
  17. /// </summary>
  18. internal class LabelSettingDialog : PdnBaseForm
  19. {
  20. /// <summary>
  21. /// 标注一二级关系
  22. /// </summary>
  23. private static List<LabelRelationModel> list;
  24. /// <summary>
  25. /// 当前选中的二级标注
  26. /// </summary>
  27. private DrawToolType drawToolType;
  28. /// <summary>
  29. /// 标注的样式
  30. /// </summary>
  31. private LabelStyleModel labelStyleModel = Startup.instance.labelStyleModel;
  32. /// <summary>
  33. /// 主配置文件的model
  34. /// </summary>
  35. private ConfigModel configModel = Startup.instance.configModel;
  36. /// <summary>
  37. /// 操作样式下拉数据
  38. /// </summary>
  39. private List<string> files = new List<string>();
  40. /// <summary>
  41. /// 另存为弹出框显示
  42. /// </summary>
  43. private CreateNameDialog dialog;
  44. /// <summary>
  45. /// 另存为文件名
  46. /// </summary>
  47. private string newName;
  48. private int initflag = 0;
  49. //各页面组件
  50. private LabelTextControl textControl;
  51. private LabelMarkDateControl dateMarkControl;
  52. private LabelMarkTimeControl timeMarkControl;
  53. private LabelMarkPointControl pointMarkControl;
  54. private LabelMarkNumberControl numberMarkControl;
  55. private LabelMarkGainNumberControl gainNumberControl;
  56. private LabelStraightLineControl straightLineControl;
  57. private LabelStraightLineSegmentControl segmentLineControl;
  58. private LabelCurvePencilControl pencilControl;
  59. private LabelCurvePolylineControl polylineControl;
  60. private LabelCurveControl curveControl;
  61. private LabelCurveClosedControl closedCurveControl;
  62. private LabelArrowOneWayControl oneWayArrowControl;
  63. private LabelArrowTwoWayControl twoWayArrowControl;
  64. private LabelCircleControl circleControl;
  65. private LabelCircleOvalControl ovalControl;
  66. private LabelPolygonRectangleControl polygonRectangleControl;
  67. private LabelPolygonControl polygonControl;
  68. private LabelPolygonRoundedControl roundedRectangleControl;
  69. private GroupBox groupBox4;
  70. private System.Windows.Forms.Label label71;
  71. private NumericUpDown numericUpDown71;
  72. private ConfigModel config = Startup.instance.configModel;
  73. private AppWorkspace appWorkspace;
  74. PaintDotNet.ColorsForm colorsForm2;
  75. PaintDotNet.ColorsForm colorsForm3;
  76. PaintDotNet.ColorsForm colorsForm4;
  77. PaintDotNet.ColorsForm colorsForm5;
  78. #region 控件
  79. private System.Windows.Forms.GroupBox groupBox1;
  80. private System.Windows.Forms.GroupBox groupBox2;
  81. private System.Windows.Forms.GroupBox groupBox3;
  82. private System.Windows.Forms.Panel panel1;
  83. private System.Windows.Forms.ListBox listBox1;
  84. private Button button3;
  85. private Button button2;
  86. private Button button4;
  87. private ComboBox comboBox1;
  88. private Label label1;
  89. private CheckBox checkbox1;
  90. private Panel panel5;
  91. private Panel panel4;
  92. private NumericUpDown numericUpDown2;
  93. private ComboBox comboBox9;
  94. private Label label19;
  95. private Label label17;
  96. private Label label16;
  97. private Label label15;
  98. private Button button5;
  99. #endregion
  100. public LabelSettingDialog(AppWorkspace appWorkspace)
  101. {
  102. if (list == null)
  103. {
  104. list = InvariantData.GetLabelRelations();
  105. }
  106. this.appWorkspace = appWorkspace;
  107. InitializeComponent();
  108. InitializeLanguageText();
  109. InitializeData();
  110. }
  111. private void InitializeLanguageText()
  112. {
  113. this.label1.Text = PdnResources.GetString("Menu.Currentoperationstyle.text") + ":";
  114. this.button4.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  115. this.button3.Text = PdnResources.GetString("Menu.File.SaveAs.Text");
  116. this.button2.Text = PdnResources.GetString("Menu.File.Save.Text");
  117. this.groupBox2.Text = PdnResources.GetString("Menu.Setting.Text");
  118. this.groupBox4.Text = PdnResources.GetString("Menu.Setting.Text");
  119. this.groupBox3.Text = PdnResources.GetString("Menu.Type.text");
  120. this.button5.Text = PdnResources.GetString("Menu.File.SaveAll.Text");
  121. this.Text = PdnResources.GetString("Menu.Setting.LabelSetting.Text");
  122. this.label71.Text = PdnResources.GetString("Markpointsize.Text") + ":";
  123. }
  124. private void InitializeComponent()
  125. {
  126. this.groupBox1 = new System.Windows.Forms.GroupBox();
  127. this.label1 = new System.Windows.Forms.Label();
  128. this.comboBox1 = new System.Windows.Forms.ComboBox();
  129. this.button4 = new System.Windows.Forms.Button();
  130. this.button3 = new System.Windows.Forms.Button();
  131. this.button2 = new System.Windows.Forms.Button();
  132. this.groupBox2 = new System.Windows.Forms.GroupBox();
  133. this.groupBox3 = new System.Windows.Forms.GroupBox();
  134. this.listBox1 = new System.Windows.Forms.ListBox();
  135. this.panel1 = new System.Windows.Forms.Panel();
  136. this.button5 = new System.Windows.Forms.Button();
  137. this.groupBox4 = new System.Windows.Forms.GroupBox();
  138. this.checkbox1 = new System.Windows.Forms.CheckBox();
  139. this.panel5 = new System.Windows.Forms.Panel();
  140. this.panel4 = new System.Windows.Forms.Panel();
  141. this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
  142. this.comboBox9 = new System.Windows.Forms.ComboBox();
  143. this.label19 = new System.Windows.Forms.Label();
  144. this.label17 = new System.Windows.Forms.Label();
  145. this.label16 = new System.Windows.Forms.Label();
  146. this.label15 = new System.Windows.Forms.Label();
  147. this.label71 = new System.Windows.Forms.Label();
  148. this.numericUpDown71 = new System.Windows.Forms.NumericUpDown();
  149. this.groupBox1.SuspendLayout();
  150. this.groupBox3.SuspendLayout();
  151. this.groupBox4.SuspendLayout();
  152. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
  153. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown71)).BeginInit();
  154. this.SuspendLayout();
  155. //
  156. // groupBox1
  157. //
  158. this.groupBox1.Controls.Add(this.label1);
  159. this.groupBox1.Controls.Add(this.comboBox1);
  160. this.groupBox1.Controls.Add(this.button4);
  161. this.groupBox1.Controls.Add(this.button3);
  162. this.groupBox1.Controls.Add(this.button2);
  163. this.groupBox1.Location = new System.Drawing.Point(134, 13);
  164. this.groupBox1.Name = "groupBox1";
  165. this.groupBox1.Size = new System.Drawing.Size(638, 58);
  166. this.groupBox1.TabIndex = 1;
  167. this.groupBox1.TabStop = false;
  168. //
  169. // label1
  170. //
  171. this.label1.AutoSize = true;
  172. this.label1.Location = new System.Drawing.Point(176, 25);
  173. this.label1.Name = "label1";
  174. this.label1.Size = new System.Drawing.Size(89, 12);
  175. this.label1.TabIndex = 5;
  176. this.label1.Text = "当前操作样式:";
  177. //
  178. // comboBox1
  179. //
  180. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  181. this.comboBox1.FormattingEnabled = true;
  182. this.comboBox1.Location = new System.Drawing.Point(271, 21);
  183. this.comboBox1.Name = "comboBox1";
  184. this.comboBox1.Size = new System.Drawing.Size(116, 20);
  185. this.comboBox1.TabIndex = 4;
  186. this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  187. //
  188. // button4
  189. //
  190. this.button4.Location = new System.Drawing.Point(393, 20);
  191. this.button4.Name = "button4";
  192. this.button4.Size = new System.Drawing.Size(75, 23);
  193. this.button4.TabIndex = 3;
  194. this.button4.Text = "删除";
  195. this.button4.UseVisualStyleBackColor = true;
  196. this.button4.Click += new System.EventHandler(this.button4_Click);
  197. //
  198. // button3
  199. //
  200. this.button3.Location = new System.Drawing.Point(474, 20);
  201. this.button3.Name = "button3";
  202. this.button3.Size = new System.Drawing.Size(75, 23);
  203. this.button3.TabIndex = 2;
  204. this.button3.Text = "另存为";
  205. this.button3.UseVisualStyleBackColor = true;
  206. this.button3.Click += new System.EventHandler(this.button3_Click);
  207. //
  208. // button2
  209. //
  210. this.button2.Location = new System.Drawing.Point(555, 20);
  211. this.button2.Name = "button2";
  212. this.button2.Size = new System.Drawing.Size(75, 23);
  213. this.button2.TabIndex = 1;
  214. this.button2.Text = "保存";
  215. this.button2.UseVisualStyleBackColor = true;
  216. this.button2.Click += new System.EventHandler(this.button2_Click);
  217. //
  218. // groupBox2
  219. //
  220. this.groupBox2.Location = new System.Drawing.Point(137, 114);
  221. this.groupBox2.Name = "groupBox2";
  222. this.groupBox2.Size = new System.Drawing.Size(633, 235);
  223. this.groupBox2.TabIndex = 2;
  224. this.groupBox2.TabStop = false;
  225. this.groupBox2.Text = "设置";
  226. //
  227. // groupBox3
  228. //
  229. this.groupBox3.Controls.Add(this.listBox1);
  230. this.groupBox3.Location = new System.Drawing.Point(13, 13);
  231. this.groupBox3.Name = "groupBox3";
  232. this.groupBox3.Size = new System.Drawing.Size(115, 340);
  233. this.groupBox3.TabIndex = 3;
  234. this.groupBox3.TabStop = false;
  235. this.groupBox3.Text = "类型";
  236. //
  237. // listBox1
  238. //
  239. this.listBox1.FormattingEnabled = true;
  240. this.listBox1.ItemHeight = 12;
  241. this.listBox1.Location = new System.Drawing.Point(6, 20);
  242. this.listBox1.Name = "listBox1";
  243. this.listBox1.Size = new System.Drawing.Size(103, 316);
  244. this.listBox1.TabIndex = 0;
  245. this.listBox1.SelectedValueChanged += new System.EventHandler(this.listBox1_SelectedValueChanged);
  246. //
  247. // panel1
  248. //
  249. this.panel1.Location = new System.Drawing.Point(134, 78);
  250. this.panel1.Name = "panel1";
  251. this.panel1.Size = new System.Drawing.Size(556, 36);
  252. this.panel1.TabIndex = 5;
  253. //
  254. // button5
  255. //
  256. this.button5.Location = new System.Drawing.Point(692, 78);
  257. this.button5.Name = "button5";
  258. this.button5.Size = new System.Drawing.Size(75, 23);
  259. this.button5.TabIndex = 4;
  260. this.button5.Text = "保存全部";
  261. this.button5.UseVisualStyleBackColor = true;
  262. this.button5.Click += new System.EventHandler(this.button5_Click);
  263. //
  264. // groupBox4
  265. //
  266. this.groupBox4.Controls.Add(this.checkbox1);
  267. this.groupBox4.Controls.Add(this.panel5);
  268. this.groupBox4.Controls.Add(this.panel4);
  269. this.groupBox4.Controls.Add(this.numericUpDown2);
  270. this.groupBox4.Controls.Add(this.comboBox9);
  271. this.groupBox4.Controls.Add(this.label19);
  272. this.groupBox4.Controls.Add(this.label17);
  273. this.groupBox4.Controls.Add(this.label16);
  274. this.groupBox4.Controls.Add(this.label15);
  275. this.groupBox4.Controls.Add(this.label71);
  276. this.groupBox4.Controls.Add(this.numericUpDown71);
  277. this.groupBox4.Location = new System.Drawing.Point(137, 76);
  278. this.groupBox4.Name = "groupBox4";
  279. this.groupBox4.Size = new System.Drawing.Size(716, 277);
  280. this.groupBox4.TabIndex = 6;
  281. this.groupBox4.TabStop = false;
  282. this.groupBox4.Text = "设置";
  283. this.groupBox4.Visible = false;
  284. //
  285. // checkbox1
  286. //
  287. this.checkbox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  288. this.checkbox1.AutoSize = true;
  289. this.checkbox1.Location = new System.Drawing.Point(136, 238);
  290. this.checkbox1.Name = "checkbox1";
  291. this.checkbox1.Size = new System.Drawing.Size(78, 16);
  292. this.checkbox1.TabIndex = 42;
  293. this.checkbox1.Text = "跟随缩放 ";
  294. this.checkbox1.UseVisualStyleBackColor = true;
  295. //
  296. // panel5
  297. //
  298. this.panel5.BackColor = System.Drawing.SystemColors.Window;
  299. this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  300. this.panel5.Location = new System.Drawing.Point(137, 106);
  301. this.panel5.Name = "panel5";
  302. this.panel5.Size = new System.Drawing.Size(152, 20);
  303. this.panel5.TabIndex = 41;
  304. this.panel5.Click += new EventHandler(panel5Click);
  305. //
  306. // panel4
  307. //
  308. this.panel4.BackColor = System.Drawing.SystemColors.Window;
  309. this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  310. this.panel4.Location = new System.Drawing.Point(137, 192);
  311. this.panel4.Name = "panel4";
  312. this.panel4.Size = new System.Drawing.Size(152, 20);
  313. this.panel4.TabIndex = 40;
  314. this.panel4.Click += new EventHandler(panel4Click);
  315. //
  316. // numericUpDown2
  317. //
  318. this.numericUpDown2.Location = new System.Drawing.Point(137, 147);
  319. this.numericUpDown2.Maximum = new decimal(new int[] {
  320. 100000,
  321. 0,
  322. 0,
  323. 0});
  324. this.numericUpDown2.Name = "numericUpDown2";
  325. this.numericUpDown2.Size = new System.Drawing.Size(152, 21);
  326. this.numericUpDown2.TabIndex = 39;
  327. //
  328. // comboBox9
  329. //
  330. this.comboBox9.FormattingEnabled = true;
  331. this.comboBox9.Location = new System.Drawing.Point(137, 60);
  332. this.comboBox9.Name = "comboBox9";
  333. this.comboBox9.Size = new System.Drawing.Size(150, 20);
  334. this.comboBox9.TabIndex = 38;
  335. //
  336. // label19
  337. //
  338. this.label19.AutoSize = true;
  339. this.label19.Location = new System.Drawing.Point(64, 196);
  340. this.label19.Name = "label19";
  341. this.label19.Size = new System.Drawing.Size(65, 12);
  342. this.label19.TabIndex = 37;
  343. this.label19.Text = "填充颜色:";
  344. //
  345. // label17
  346. //
  347. this.label17.AutoSize = true;
  348. this.label17.Location = new System.Drawing.Point(64, 151);
  349. this.label17.Name = "label17";
  350. this.label17.Size = new System.Drawing.Size(65, 12);
  351. this.label17.TabIndex = 36;
  352. this.label17.Text = "线条宽度:";
  353. //
  354. // label16
  355. //
  356. this.label16.AutoSize = true;
  357. this.label16.Location = new System.Drawing.Point(66, 110);
  358. this.label16.Name = "label16";
  359. this.label16.Size = new System.Drawing.Size(65, 12);
  360. this.label16.TabIndex = 35;
  361. this.label16.Text = "线条颜色:";
  362. //
  363. // label15
  364. //
  365. this.label15.AutoSize = true;
  366. this.label15.Location = new System.Drawing.Point(54, 64);
  367. this.label15.Name = "label15";
  368. this.label15.Size = new System.Drawing.Size(77, 12);
  369. this.label15.TabIndex = 34;
  370. this.label15.Text = "标记点样式:";
  371. //
  372. // label71
  373. //
  374. this.label71.Location = new System.Drawing.Point(6, 27);
  375. this.label71.Name = "label71";
  376. this.label71.Size = new System.Drawing.Size(125, 13);
  377. this.label71.TabIndex = 0;
  378. this.label71.Text = "标记点大小:";
  379. this.label71.TextAlign = System.Drawing.ContentAlignment.TopRight;
  380. //
  381. // numericUpDown71
  382. //
  383. this.numericUpDown71.Location = new System.Drawing.Point(134, 23);
  384. this.numericUpDown71.Maximum = new decimal(new int[] {
  385. 100000,
  386. 0,
  387. 0,
  388. 0});
  389. this.numericUpDown71.Name = "numericUpDown71";
  390. this.numericUpDown71.Size = new System.Drawing.Size(152, 21);
  391. this.numericUpDown71.TabIndex = 14;
  392. //
  393. // LabelSettingDialog
  394. //
  395. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  396. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  397. this.ClientSize = new System.Drawing.Size(776, 359);
  398. this.Controls.Add(this.button5);
  399. this.Controls.Add(this.panel1);
  400. this.Controls.Add(this.groupBox3);
  401. this.Controls.Add(this.groupBox1);
  402. this.Controls.Add(this.groupBox4);
  403. this.Controls.Add(this.groupBox2);
  404. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  405. this.MaximizeBox = false;
  406. this.MinimizeBox = false;
  407. this.Name = "LabelSettingDialog";
  408. this.Text = "标注设置";
  409. this.Controls.SetChildIndex(this.groupBox2, 0);
  410. this.Controls.SetChildIndex(this.groupBox4, 0);
  411. this.Controls.SetChildIndex(this.groupBox1, 0);
  412. this.Controls.SetChildIndex(this.groupBox3, 0);
  413. this.Controls.SetChildIndex(this.panel1, 0);
  414. this.Controls.SetChildIndex(this.button5, 0);
  415. this.groupBox1.ResumeLayout(false);
  416. this.groupBox1.PerformLayout();
  417. this.groupBox3.ResumeLayout(false);
  418. this.groupBox4.ResumeLayout(false);
  419. this.groupBox4.PerformLayout();
  420. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
  421. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown71)).EndInit();
  422. this.ResumeLayout(false);
  423. }
  424. /// <summary>
  425. /// 初始化数据
  426. /// </summary>
  427. private void InitializeData()
  428. {
  429. this.colorsForm2 = new ColorsForm();
  430. this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
  431. this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  432. this.colorsForm3 = new ColorsForm();
  433. this.colorsForm3.StartPosition = FormStartPosition.CenterScreen;
  434. this.colorsForm3.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  435. this.colorsForm4 = new ColorsForm();
  436. this.colorsForm4.StartPosition = FormStartPosition.CenterScreen;
  437. this.colorsForm4.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  438. this.colorsForm5 = new ColorsForm();
  439. this.colorsForm5.StartPosition = FormStartPosition.CenterScreen;
  440. this.colorsForm5.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  441. //绑定左侧listbox数据
  442. this.listBox1.Items.Clear();
  443. foreach (LabelRelationModel model in list)
  444. {
  445. this.listBox1.Items.Add(model.name);
  446. }
  447. this.listBox1.SelectedIndex = 0;
  448. //绑定样式下拉
  449. if (initflag++ == 0)
  450. {
  451. InitializeStyleName();
  452. }
  453. //更新右侧设置界面
  454. UpdateRightSettingUI();
  455. #region [选中样式]
  456. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  457. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  458. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  459. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  460. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  461. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  462. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  463. #endregion
  464. #region [标记点相关]
  465. this.comboBox9.Items.Add("正方形");
  466. this.comboBox9.Items.Add("圆形");
  467. this.comboBox9.Items.Add("三角形");
  468. this.numericUpDown71.Value = this.config.MarkpointWidth;
  469. this.comboBox9.SelectedIndex = this.config.MarkpointStyle;
  470. this.panel5.BackColor = Color.FromArgb(this.config.MarkpointLineColor);
  471. this.numericUpDown2.Value = this.config.MarkpointLineWidth;
  472. this.panel4.BackColor = Color.FromArgb(this.config.MarkpointAreaColor);
  473. this.checkbox1.Checked = this.config.isFollow;
  474. #endregion
  475. }
  476. /// <summary>
  477. /// 初始化样式下拉
  478. /// </summary>
  479. private void InitializeStyleName()
  480. {
  481. List<string> fileNames = FileOperationHelper.GetFileList(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\");
  482. files.Clear();
  483. foreach (string fileName in fileNames)
  484. {
  485. string name = fileName.Substring(0, fileName.LastIndexOf("."));
  486. files.Add(name);
  487. }
  488. this.comboBox1.SelectedIndexChanged -= this.comboBox1_SelectedIndexChanged;
  489. this.comboBox1.DataSource = null;
  490. this.comboBox1.DataSource = files;
  491. string nowModelName = Startup.instance.configModel.Watermark.Substring(0, Startup.instance.configModel.Watermark.LastIndexOf("."));
  492. this.comboBox1.SelectedIndex = files.FindIndex(a => a.Equals(nowModelName));
  493. this.labelStyleModel = XmlSerializeHelper.DESerializer<LabelStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
  494. this.comboBox1.SelectedIndexChanged += new EventHandler(this.comboBox1_SelectedIndexChanged);
  495. }
  496. /// <summary>
  497. /// 当前操作样式 下拉选切换
  498. /// </summary>
  499. /// <param name="sender"></param>
  500. /// <param name="e"></param>
  501. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  502. {
  503. this.labelStyleModel = XmlSerializeHelper.DESerializer<LabelStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
  504. InitializeData();
  505. }
  506. /// <summary>
  507. /// 左侧listbox选择事件
  508. /// </summary>
  509. /// <param name="sender"></param>
  510. /// <param name="e"></param>
  511. private void listBox1_SelectedValueChanged(object sender, EventArgs e)
  512. {
  513. //首先更新右侧分类部分
  514. UpdateRightCatalog();
  515. //更新右侧设置界面
  516. UpdateRightSettingUI();
  517. //刷新右侧预览
  518. UpdateRightPreview();
  519. }
  520. /// <summary>
  521. /// 更新右侧分类
  522. /// </summary>
  523. private void UpdateRightCatalog()
  524. {
  525. this.panel1.Controls.Clear();
  526. LabelRelationModel model = list[this.listBox1.SelectedIndex];
  527. int postion = 0;
  528. if (model.id == 8)
  529. {
  530. groupBox2.Visible = false;
  531. panel1.Visible = false;
  532. button5.Visible = false;
  533. groupBox4.Visible = true;
  534. comboBox1.Visible = false;
  535. button4.Visible = false;
  536. button3.Visible = false;
  537. label1.Visible = false;
  538. }
  539. else {
  540. groupBox2.Visible = true;
  541. panel1.Visible = true;
  542. button5.Visible = true;
  543. groupBox4.Visible = false;
  544. comboBox1.Visible = true;
  545. button4.Visible = true;
  546. button3.Visible = true;
  547. label1.Visible = true;
  548. }
  549. foreach (LabelRelationModel.ChildLabel child in model.childLabel)
  550. {
  551. Button button = new Button();
  552. button.Size = new Size(75, 23);
  553. button.Location = new Point(postion * 75 + 5, 0);
  554. button.Text = child.name;
  555. button.Tag = child;
  556. button.Click += new EventHandler(ChildButton_Click);
  557. this.panel1.Controls.Add(button);
  558. if (postion == 0)
  559. {
  560. this.drawToolType = child.drawToolType;
  561. button.Focus();
  562. }
  563. postion++;
  564. }
  565. }
  566. /// <summary>
  567. /// 二级分类按钮点击事件
  568. /// </summary>
  569. /// <param name="sender"></param>
  570. /// <param name="e"></param>
  571. private void ChildButton_Click(object sender, EventArgs e)
  572. {
  573. Button button = (Button)sender;
  574. LabelRelationModel.ChildLabel child = (LabelRelationModel.ChildLabel)button.Tag;
  575. this.drawToolType = child.drawToolType;
  576. this.UpdateRightSettingUI();
  577. }
  578. /// <summary>
  579. /// 更新右侧设置
  580. /// </summary>
  581. private void UpdateRightSettingUI()
  582. {
  583. this.groupBox2.Controls.Clear();
  584. switch (this.drawToolType)
  585. {
  586. case DrawToolType.DrawTextString: //文本
  587. textControl = new LabelTextControl(this.labelStyleModel.text);
  588. textControl.Location = new Point(10, 15);
  589. #region [选中样式]
  590. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  591. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  592. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  593. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  594. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  595. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  596. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  597. #endregion
  598. this.groupBox2.Controls.Add(textControl);
  599. break;
  600. case DrawToolType.DrawDateMark: //标记-日期
  601. dateMarkControl = new LabelMarkDateControl(this.labelStyleModel.dateMark);
  602. dateMarkControl.Location = new Point(10, 15);
  603. this.groupBox2.Controls.Add(dateMarkControl);
  604. #region [选中样式]
  605. //this.comboBox20.Text = this.labelStyleModel.dateMark.chooseStyle == null ? "" : this.labelStyleModel.dateMark.chooseStyle.font;
  606. //this.numericUpDown4.Value = this.labelStyleModel.dateMark.chooseStyle == null ? 1 : this.labelStyleModel.dateMark.chooseStyle.lineWidth;
  607. //this.numericUpDown5.Value = this.labelStyleModel.dateMark.chooseStyle == null ? 1 : this.labelStyleModel.dateMark.chooseStyle.fontSize;
  608. //this.panel9.BackColor = this.labelStyleModel.dateMark.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.dateMark.chooseStyle.textColor);
  609. //this.numericUpDown3.Value = this.labelStyleModel.dateMark.chooseStyle == null ? 0 : this.labelStyleModel.dateMark.chooseStyle.vLineLength;
  610. //this.panel8.BackColor = this.labelStyleModel.dateMark.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.dateMark.chooseStyle.lineColor);
  611. //this.comboBox18.SelectedIndex = this.labelStyleModel.dateMark.chooseStyle == null ? 0 : this.labelStyleModel.dateMark.chooseStyle.lineStyle;
  612. #endregion
  613. break;
  614. case DrawToolType.DrawTimeMark: //标记-时间
  615. timeMarkControl = new LabelMarkTimeControl(this.labelStyleModel.timeMark);
  616. timeMarkControl.Location = new Point(10, 15);
  617. this.groupBox2.Controls.Add(timeMarkControl);
  618. #region [选中样式]
  619. //this.comboBox20.Text = this.labelStyleModel.timeMark.chooseStyle == null ? "" : this.labelStyleModel.tetimeMarkxt.chooseStyle.font;
  620. //this.numericUpDown4.Value = this.labelStyleModel.timeMark.chooseStyle == null ? 1 : this.labelStyleModel.timeMark.chooseStyle.lineWidth;
  621. //this.numericUpDown5.Value = this.labelStyleModel.timeMark.chooseStyle == null ? 1 : this.labelStyleModel.timeMark.chooseStyle.fontSize;
  622. //this.panel9.BackColor = this.labelStyleModel.timeMark.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.timeMark.chooseStyle.textColor);
  623. //this.numericUpDown3.Value = this.labelStyleModel.timeMark.chooseStyle == null ? 0 : this.labelStyleModel.timeMark.chooseStyle.vLineLength;
  624. //this.panel8.BackColor = this.labelStyleModel.timeMark.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.timeMark.chooseStyle.lineColor);
  625. //this.comboBox18.SelectedIndex = this.labelStyleModel.timeMark.chooseStyle == null ? 0 : this.labelStyleModel.timeMark.chooseStyle.lineStyle;
  626. #endregion
  627. break;
  628. case DrawToolType.DrawPointMark: //标记-点标记
  629. pointMarkControl = new LabelMarkPointControl(this.labelStyleModel.pointMark);
  630. pointMarkControl.Location = new Point(10, 15);
  631. this.groupBox2.Controls.Add(pointMarkControl);
  632. #region [选中样式]
  633. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  634. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  635. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  636. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  637. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  638. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  639. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  640. #endregion
  641. break;
  642. case DrawToolType.DrawNumberMark: //标记-数字标记
  643. numberMarkControl = new LabelMarkNumberControl(this.labelStyleModel.numberMark);
  644. numberMarkControl.Location = new Point(10, 15);
  645. this.groupBox2.Controls.Add(numberMarkControl);
  646. #region [选中样式]
  647. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  648. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  649. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  650. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  651. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  652. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  653. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  654. #endregion
  655. break;
  656. case DrawToolType.DrawGainNumber: //标记-放大倍数
  657. gainNumberControl = new LabelMarkGainNumberControl(this.labelStyleModel.gainNumber);
  658. gainNumberControl.Location = new Point(10, 15);
  659. this.groupBox2.Controls.Add(gainNumberControl);
  660. #region [选中样式]
  661. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  662. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  663. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  664. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  665. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  666. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  667. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  668. #endregion
  669. break;
  670. case DrawToolType.DrawLine: //直线->直线
  671. straightLineControl = new LabelStraightLineControl(this.labelStyleModel.lineChildLine);
  672. straightLineControl.Location = new Point(10, 15);
  673. this.groupBox2.Controls.Add(straightLineControl);
  674. #region [选中样式]
  675. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  676. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  677. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  678. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  679. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  680. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  681. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  682. #endregion
  683. break;
  684. case DrawToolType.DrawLineSegment: //直线->线段
  685. segmentLineControl = new LabelStraightLineSegmentControl(this.labelStyleModel.lineChildLineSegment);
  686. segmentLineControl.Location = new Point(10, 15);
  687. this.groupBox2.Controls.Add(segmentLineControl);
  688. #region [选中样式]
  689. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  690. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  691. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  692. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  693. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  694. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  695. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  696. #endregion
  697. break;
  698. case DrawToolType.DrawPencil: //曲线->铅笔
  699. pencilControl = new LabelCurvePencilControl(this.labelStyleModel.pencilModel);
  700. pencilControl.Location = new Point(10, 15);
  701. this.groupBox2.Controls.Add(pencilControl);
  702. #region [选中样式]
  703. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  704. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  705. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  706. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  707. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  708. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  709. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  710. #endregion
  711. break;
  712. case DrawToolType.DrawPolygonLine: //曲线->折线
  713. polylineControl = new LabelCurvePolylineControl(this.labelStyleModel.polylineModel);
  714. polylineControl.Location = new Point(10, 15);
  715. this.groupBox2.Controls.Add(polylineControl);
  716. #region [选中样式]
  717. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  718. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  719. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  720. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  721. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  722. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  723. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  724. #endregion
  725. break;
  726. case DrawToolType.DrawCurve: //曲线->曲线
  727. curveControl = new LabelCurveControl(this.labelStyleModel.curveModel);
  728. curveControl.Location = new Point(10, 15);
  729. this.groupBox2.Controls.Add(curveControl);
  730. #region [选中样式]
  731. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  732. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  733. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  734. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  735. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  736. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  737. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  738. #endregion
  739. break;
  740. case DrawToolType.DrawClosedCurve: //曲线->闭合曲线
  741. closedCurveControl = new LabelCurveClosedControl(this.labelStyleModel.closedCurveModel);
  742. closedCurveControl.Location = new Point(10, 15);
  743. this.groupBox2.Controls.Add(closedCurveControl);
  744. #region [选中样式]
  745. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  746. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  747. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  748. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  749. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  750. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  751. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  752. #endregion
  753. break;
  754. case DrawToolType.DrawOneArrowLine: //箭头->单向箭头
  755. oneWayArrowControl = new LabelArrowOneWayControl(this.labelStyleModel.oneWayArrowModel);
  756. oneWayArrowControl.Location = new Point(10, 15);
  757. this.groupBox2.Controls.Add(oneWayArrowControl);
  758. #region [选中样式]
  759. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  760. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  761. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  762. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  763. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  764. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  765. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  766. #endregion
  767. break;
  768. case DrawToolType.DrawTwoArrowLine: //箭头->双向箭头
  769. twoWayArrowControl = new LabelArrowTwoWayControl(this.labelStyleModel.twoWayArrowModel);
  770. twoWayArrowControl.Location = new Point(10, 15);
  771. this.groupBox2.Controls.Add(twoWayArrowControl);
  772. #region [选中样式]
  773. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  774. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  775. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  776. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  777. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  778. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  779. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  780. #endregion
  781. break;
  782. case DrawToolType.DrawCircle: //圆->圆
  783. circleControl = new LabelCircleControl(this.labelStyleModel.circleModel);
  784. circleControl.Location = new Point(10, 15);
  785. this.groupBox2.Controls.Add(circleControl);
  786. #region [选中样式]
  787. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  788. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  789. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  790. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  791. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  792. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  793. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  794. #endregion
  795. break;
  796. case DrawToolType.DrawEllipse: //圆->椭圆
  797. ovalControl = new LabelCircleOvalControl(this.labelStyleModel.ovalModel);
  798. ovalControl.Location = new Point(10, 15);
  799. this.groupBox2.Controls.Add(ovalControl);
  800. #region [选中样式]
  801. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  802. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  803. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  804. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  805. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  806. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  807. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  808. #endregion
  809. break;
  810. case DrawToolType.DrawRectangle: //多边形->矩形
  811. polygonRectangleControl = new LabelPolygonRectangleControl(this.labelStyleModel.polygonRectangle);
  812. polygonRectangleControl.Location = new Point(10, 15);
  813. this.groupBox2.Controls.Add(polygonRectangleControl);
  814. #region [选中样式]
  815. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  816. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  817. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  818. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  819. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  820. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  821. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  822. #endregion
  823. break;
  824. case DrawToolType.DrawPolygon: //多边形->多边形
  825. polygonControl = new LabelPolygonControl(this.labelStyleModel.polygonPolygon);
  826. polygonControl.Location = new Point(10, 15);
  827. this.groupBox2.Controls.Add(polygonControl);
  828. #region [选中样式]
  829. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  830. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  831. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  832. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  833. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  834. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  835. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  836. #endregion
  837. break;
  838. case DrawToolType.DrawRoundRectangle: //多边形->圆角矩形
  839. roundedRectangleControl = new LabelPolygonRoundedControl(this.labelStyleModel.roundedRectangle);
  840. roundedRectangleControl.Location = new Point(10, 15);
  841. this.groupBox2.Controls.Add(roundedRectangleControl);
  842. #region [选中样式]
  843. //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font;
  844. //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth;
  845. //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize;
  846. //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor);
  847. //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength;
  848. //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor);
  849. //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle;
  850. #endregion
  851. break;
  852. }
  853. }
  854. /// <summary>
  855. /// 刷新右侧预览图
  856. /// </summary>
  857. private void UpdateRightPreview()
  858. {
  859. }
  860. /// <summary>
  861. /// 删除
  862. /// </summary>
  863. /// <param name="sender"></param>
  864. /// <param name="e"></param>
  865. private void button4_Click(object sender, EventArgs e)
  866. {
  867. if ("Default".Equals(this.comboBox1.Text))
  868. {
  869. MessageBox.Show(PdnResources.GetString("Menu.efaultstylecannotbedelete.Text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
  870. return;
  871. }
  872. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.nfirmthedeleti.Text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  873. if (dr == DialogResult.OK)
  874. {
  875. int newIndex = 0;
  876. int selectIndex = this.comboBox1.SelectedIndex;
  877. int tall = files.Count - 1;
  878. if (selectIndex < tall)
  879. {
  880. newIndex = selectIndex;
  881. }
  882. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.Text + ".xml";
  883. FileInfo fileInfo = new FileInfo(filePath);
  884. fileInfo.Delete();
  885. InitializeStyleName();
  886. this.comboBox1.SelectedIndex = newIndex;
  887. this.labelStyleModel = XmlSerializeHelper.DESerializer<LabelStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
  888. InitializeData();
  889. }
  890. else if (dr == DialogResult.Cancel)
  891. {
  892. }
  893. }
  894. /// <summary>
  895. /// 另存为 出弹窗
  896. /// </summary>
  897. /// <param name="sender"></param>
  898. /// <param name="e"></param>
  899. private void button3_Click(object sender, EventArgs e)
  900. {
  901. dialog = new CreateNameDialog(this);
  902. dialog.Text = PdnResources.GetString("Menu.Set.Watermarksettings.Newstyle.text");
  903. dialog.StartPosition = FormStartPosition.CenterParent;
  904. dialog.ShowDialog();
  905. }
  906. /// <summary>
  907. /// 另存为弹窗 确定保存
  908. /// </summary>
  909. /// <param name="name"></param>
  910. public override void GetCreateName(string name)
  911. {
  912. string currentcomboBox = this.comboBox1.Text;
  913. this.newName = name;
  914. if (files.Contains(this.newName))
  915. {
  916. MessageBox.Show(PdnResources.GetString("Menu.Stylenamecannotberepeated.text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
  917. return;
  918. }
  919. LabelStyleModel newModel = this.labelStyleModel;
  920. modelSave(newModel);
  921. //另存为
  922. string stageModelXml = XmlSerializeHelper.XmlSerialize<LabelStyleModel>(newModel);
  923. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.newName + ".xml";
  924. FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
  925. InitializeStyleName();
  926. this.comboBox1.Text = currentcomboBox;
  927. dialog.Close();
  928. }
  929. /// <summary>
  930. /// 保存
  931. /// </summary>
  932. /// <param name="sender"></param>
  933. /// <param name="e"></param>
  934. private void button2_Click(object sender, EventArgs e)
  935. {
  936. this.labelStyleModel = modelSave(this.labelStyleModel);
  937. //以下保存xml文件信息
  938. string stageModelXml = XmlSerializeHelper.XmlSerialize<LabelStyleModel>(this.labelStyleModel);
  939. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.Text + ".xml";
  940. FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
  941. this.config.MarkpointWidth = Convert.ToInt32(this.numericUpDown71.Value);
  942. this.config.MarkpointStyle = this.comboBox9.SelectedIndex;
  943. this.config.MarkpointLineColor = this.panel5.BackColor.ToArgb();
  944. this.config.MarkpointLineWidth = Convert.ToInt32(this.numericUpDown2.Value);
  945. this.config.MarkpointAreaColor = this.panel4.BackColor.ToArgb();
  946. this.config.isFollow = this.checkbox1.Checked;
  947. string configModelXml = XmlSerializeHelper.XmlSerialize<ConfigModel>(config);
  948. FileOperationHelper.WriteStringToFile(configModelXml, Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Config.xml", FileMode.Create);
  949. MarkPointRect.markPointRectWidth = configModel.MarkpointWidth;
  950. //if (this.appWorkspace.DocumentWorkspaces != null)
  951. //{
  952. // foreach (var item in this.appWorkspace.DocumentWorkspaces)
  953. // {
  954. // if (item != null && item.GraphicsList != null)
  955. // foreach (var graObject in item.GraphicsList.graphicsList)
  956. // {
  957. // graObject.smallRectangleWidth = this.config.MarkpointWidth;
  958. // }
  959. // item.Refresh();
  960. // }
  961. //}
  962. DrawObject.smallRectangleWidth = this.config.MarkpointWidth;
  963. DrawObject.MarkpointStyle = this.config.MarkpointStyle;
  964. DrawObject.MarkpointLineColor = this.config.MarkpointLineColor;
  965. DrawObject.MarkpointLineWidth = this.config.MarkpointLineWidth;
  966. DrawObject.MarkpointAreaColor = this.config.MarkpointAreaColor;
  967. DrawObject.isFollow = this.checkbox1.Checked;
  968. ApplicationSetting();
  969. }
  970. /// <summary>
  971. /// 各个子页面的model保存方法
  972. /// </summary>
  973. private LabelStyleModel modelSave(LabelStyleModel model)
  974. {
  975. switch (this.drawToolType)
  976. {
  977. case DrawToolType.DrawTextString: //文本
  978. model.text = textControl.getNowModel(this.labelStyleModel.text);
  979. break;
  980. case DrawToolType.DrawDateMark: //标记-日期
  981. model.dateMark = dateMarkControl.getNowModel(this.labelStyleModel.dateMark);
  982. break;
  983. case DrawToolType.DrawTimeMark: //标记-时间
  984. model.timeMark = timeMarkControl.getNowModel(this.labelStyleModel.timeMark);
  985. break;
  986. case DrawToolType.DrawPointMark: //标记-点标记
  987. model.pointMark = pointMarkControl.getNowModel(this.labelStyleModel.pointMark);
  988. break;
  989. case DrawToolType.DrawNumberMark: //标记-数字标记
  990. model.numberMark = numberMarkControl.getNowModel(this.labelStyleModel.numberMark);
  991. break;
  992. case DrawToolType.DrawGainNumber: //标记-放大倍数
  993. model.gainNumber = gainNumberControl.getNowModel(this.labelStyleModel.gainNumber);
  994. break;
  995. case DrawToolType.DrawLine: //直线->直线
  996. model.lineChildLine = straightLineControl.getNowModel(this.labelStyleModel.lineChildLine);
  997. break;
  998. case DrawToolType.DrawLineSegment: //直线->线段
  999. model.lineChildLineSegment = segmentLineControl.getNowModel(this.labelStyleModel.lineChildLineSegment);
  1000. break;
  1001. case DrawToolType.DrawPencil: //曲线->铅笔
  1002. model.pencilModel = pencilControl.getNowModel(this.labelStyleModel.pencilModel);
  1003. break;
  1004. case DrawToolType.DrawPolygonLine: //曲线->折线
  1005. model.polylineModel = polylineControl.getNowModel(this.labelStyleModel.polylineModel);
  1006. break;
  1007. case DrawToolType.DrawCurve: //曲线->曲线
  1008. model.curveModel = curveControl.getNowModel(this.labelStyleModel.curveModel);
  1009. break;
  1010. case DrawToolType.DrawClosedCurve: //曲线->闭合曲线
  1011. model.closedCurveModel = closedCurveControl.getNowModel(this.labelStyleModel.closedCurveModel);
  1012. break;
  1013. case DrawToolType.DrawOneArrowLine: //箭头->单向箭头
  1014. model.oneWayArrowModel = oneWayArrowControl.getNowModel(this.labelStyleModel.oneWayArrowModel);
  1015. break;
  1016. case DrawToolType.DrawTwoArrowLine: //箭头->双向箭头
  1017. model.twoWayArrowModel = twoWayArrowControl.getNowModel(this.labelStyleModel.twoWayArrowModel);
  1018. break;
  1019. case DrawToolType.DrawCircle: //圆->圆
  1020. model.circleModel = circleControl.getNowModel(this.labelStyleModel.circleModel);
  1021. break;
  1022. case DrawToolType.DrawEllipse: //圆->椭圆
  1023. model.ovalModel = ovalControl.getNowModel(this.labelStyleModel.ovalModel);
  1024. break;
  1025. case DrawToolType.DrawRectangle: //多边形->矩形
  1026. model.polygonRectangle = polygonRectangleControl.getNowModel(this.labelStyleModel.polygonRectangle);
  1027. break;
  1028. case DrawToolType.DrawPolygon: //多边形->多边形
  1029. model.polygonPolygon = polygonControl.getNowModel(this.labelStyleModel.polygonPolygon);
  1030. break;
  1031. case DrawToolType.DrawRoundRectangle: //多边形->圆角矩形
  1032. model.roundedRectangle = roundedRectangleControl.getNowModel(this.labelStyleModel.roundedRectangle);
  1033. break;
  1034. }
  1035. return model;
  1036. }
  1037. /// <summary>
  1038. /// 应用
  1039. /// </summary>
  1040. /// <param name="sender"></param>
  1041. /// <param name="e"></param>
  1042. private void ApplicationSetting()
  1043. {
  1044. //修改缓存中的样式数据
  1045. Startup.instance.labelStyleModel = this.labelStyleModel;
  1046. //修改主配置文件中的值
  1047. configModel.LabelStyle = this.comboBox1.Text + ".xml";
  1048. //修改主配置文件的xml
  1049. string configModelXml = XmlSerializeHelper.XmlSerialize<ConfigModel>(this.configModel);
  1050. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Config.xml";
  1051. FileOperationHelper.WriteStringToFile(configModelXml, filePath, FileMode.Create);
  1052. MessageBox.Show(PdnResources.GetString("Menu.Successfullysaved.text"));
  1053. }
  1054. /// <summary>
  1055. /// 应用全部
  1056. /// </summary>
  1057. /// <param name="sender"></param>
  1058. /// <param name="e"></param>
  1059. private void button5_Click(object sender, EventArgs e)
  1060. {
  1061. switch (this.drawToolType)
  1062. {
  1063. case DrawToolType.DrawTextString: //文本
  1064. this.labelStyleModel.text = textControl.getNowModel(this.labelStyleModel.text);
  1065. break;
  1066. case DrawToolType.DrawDateMark: //标记-日期
  1067. this.labelStyleModel = dateMarkControl.ApplyAll(this.labelStyleModel);
  1068. break;
  1069. case DrawToolType.DrawTimeMark: //标记-时间
  1070. this.labelStyleModel = timeMarkControl.ApplyAll(this.labelStyleModel);
  1071. break;
  1072. case DrawToolType.DrawNumberMark: //标记-数字标记
  1073. this.labelStyleModel = numberMarkControl.ApplyAll(this.labelStyleModel);
  1074. break;
  1075. case DrawToolType.DrawGainNumber: //标记-放大倍数
  1076. this.labelStyleModel = gainNumberControl.ApplyAll(this.labelStyleModel);
  1077. break;
  1078. case DrawToolType.DrawLine: //直线->直线
  1079. this.labelStyleModel = straightLineControl.ApplyAll(this.labelStyleModel);
  1080. break;
  1081. case DrawToolType.DrawLineSegment: //直线->线段
  1082. this.labelStyleModel = segmentLineControl.ApplyAll(this.labelStyleModel);
  1083. break;
  1084. case DrawToolType.DrawPencil: //曲线->铅笔
  1085. this.labelStyleModel = pencilControl.ApplyAll(this.labelStyleModel);
  1086. break;
  1087. case DrawToolType.DrawPolygonLine: //曲线->折线
  1088. this.labelStyleModel = polylineControl.ApplyAll(this.labelStyleModel);
  1089. break;
  1090. case DrawToolType.DrawCurve: //曲线->曲线
  1091. this.labelStyleModel = curveControl.ApplyAll(this.labelStyleModel);
  1092. break;
  1093. case DrawToolType.DrawClosedCurve: //曲线->闭合曲线
  1094. this.labelStyleModel = closedCurveControl.ApplyAll(this.labelStyleModel);
  1095. break;
  1096. case DrawToolType.DrawOneArrowLine: //箭头->单向箭头
  1097. this.labelStyleModel = oneWayArrowControl.ApplyAll(this.labelStyleModel);
  1098. break;
  1099. case DrawToolType.DrawTwoArrowLine: //箭头->双向箭头
  1100. this.labelStyleModel = twoWayArrowControl.ApplyAll(this.labelStyleModel);
  1101. break;
  1102. case DrawToolType.DrawCircle: //圆->圆
  1103. this.labelStyleModel = circleControl.ApplyAll(this.labelStyleModel);
  1104. break;
  1105. case DrawToolType.DrawEllipse: //圆->椭圆
  1106. this.labelStyleModel = ovalControl.ApplyAll(this.labelStyleModel);
  1107. break;
  1108. case DrawToolType.DrawRectangle: //多边形->矩形
  1109. this.labelStyleModel = polygonRectangleControl.ApplyAll(this.labelStyleModel);
  1110. break;
  1111. case DrawToolType.DrawPolygon: //多边形->多边形
  1112. this.labelStyleModel = polygonControl.ApplyAll(this.labelStyleModel);
  1113. break;
  1114. case DrawToolType.DrawRoundRectangle: //多边形->圆角矩形
  1115. this.labelStyleModel = roundedRectangleControl.ApplyAll(this.labelStyleModel);
  1116. break;
  1117. }
  1118. //以下保存xml文件信息
  1119. string stageModelXml = XmlSerializeHelper.XmlSerialize<LabelStyleModel>(this.labelStyleModel);
  1120. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.Text + ".xml";
  1121. FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
  1122. ApplicationSetting();
  1123. }
  1124. private void panel5Click(object sender, EventArgs e)
  1125. {
  1126. this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel5.BackColor);
  1127. this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.panel5Changed));
  1128. this.colorsForm2.ShowDialog();
  1129. }
  1130. private void panel5Changed(object sender, EventArgs e)
  1131. {
  1132. this.panel5.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
  1133. this.colorsForm2.Close();
  1134. }
  1135. private void panel4Click(object sender, EventArgs e)
  1136. {
  1137. this.colorsForm3.UserPrimaryColor = ColorBgra.FromColor(this.panel4.BackColor);
  1138. this.colorsForm3.setSaveBtn_Click(new System.EventHandler(this.panel4Changed));
  1139. this.colorsForm3.ShowDialog();
  1140. }
  1141. private void panel4Changed(object sender, EventArgs e)
  1142. {
  1143. this.panel4.BackColor = this.colorsForm3.UserPrimaryColor.ToColor();
  1144. this.colorsForm3.Close();
  1145. }
  1146. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  1147. {
  1148. }
  1149. }
  1150. }