MeasurementPropertiesDialog.cs 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501
  1. using PaintDotNet;
  2. using PaintDotNet.Annotation;
  3. using PaintDotNet.Annotation.Enum;
  4. using PaintDotNet.Annotation.Measure;
  5. using PaintDotNet.Base.CommTool;
  6. using PaintDotNet.Base.SettingModel;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.IO;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Threading.Tasks;
  17. using System.Windows.Forms;
  18. namespace Metis.Measuring
  19. {
  20. internal class MeasurementPropertiesDialog : Form
  21. {
  22. #region 控件
  23. private GroupBox groupBox2;
  24. private Panel panel3;
  25. private ComboBox comboBox4;
  26. private Label label4;
  27. private ComboBox comboBox3;
  28. private Label label3;
  29. private Panel panel2;
  30. private ComboBox comboBox2;
  31. private Label label2;
  32. private NumericUpDown numericUpDown11;
  33. private ComboBox comboBox21;
  34. private NumericUpDown numericUpDown21;
  35. private Label label61;
  36. private Label label51;
  37. private Panel linePanel;
  38. private Label label41;
  39. private Panel textPanel;
  40. private Label label31;
  41. private Label label21;
  42. private ComboBox comboBox11;
  43. private Label label11;
  44. private GroupBox groupBox1;
  45. //private Button button2;
  46. private Button button3;
  47. private Button button1;
  48. PaintDotNet.ColorsForm colorsForm;
  49. PaintDotNet.ColorsForm colorsForm1;
  50. #endregion
  51. /// <summary>
  52. /// 主控件
  53. /// </summary>
  54. private AppWorkspace appWorkspace;
  55. private DrawObject drawObject;
  56. /// <summary>
  57. /// 测量的样式
  58. /// </summary>
  59. private MeasureStyleModel measureStyleModel = Startup.instance.measureStyleModel;
  60. /// <summary>
  61. /// 主配置文件的model
  62. /// </summary>
  63. private ConfigModel configModel = Startup.instance.configModel;
  64. private NumericUpDown numericUpDown1;
  65. private Label label5;
  66. private ComboBox comboBox5;
  67. private Label label6;
  68. private ComboBox comboBox91;
  69. private System.Windows.Forms.Label label91;
  70. /// <summary>
  71. /// 字体列表
  72. /// </summary>
  73. ArrayList fontsItems = new ArrayList();
  74. public MeasurementPropertiesDialog(AppWorkspace appWorkspace, DrawObject drawObject)
  75. {
  76. this.appWorkspace = appWorkspace;
  77. this.drawObject = drawObject;
  78. InitializeComponent();
  79. this.comboBox3.Items.AddRange(new object[] {
  80. PdnResources.GetString("Menu.Upperleft.text"),
  81. PdnResources.GetString("Menu.Uppermiddle.Text"),
  82. PdnResources.GetString("Menu.Upperright.text"),
  83. PdnResources.GetString("Menu.Lowerleft.text"),
  84. PdnResources.GetString("Menu.Themiddleandlower.Text"),
  85. PdnResources.GetString("Menu.Lowerright.text")});
  86. this.comboBox91.Items.AddRange(new object[] {
  87. "度",
  88. "密位"});
  89. this.comboBox4.Items.AddRange(new object[] {
  90. PdnResources.GetString("Menu.Upperleft.text"),
  91. PdnResources.GetString("Menu.Uppermiddle.Text"),
  92. PdnResources.GetString("Menu.Upperright.text"),
  93. PdnResources.GetString("Menu.Lowerleft.text"),
  94. PdnResources.GetString("Menu.Themiddleandlower.Text"),
  95. PdnResources.GetString("Menu.Lowerright.text")});
  96. this.Text = PdnResources.GetString("Menu.MeasureAction." + drawObject.drawToolType.ToString() + ".Text") + "属性设置";
  97. //绑定线样式数据
  98. this.comboBox21.Items.AddRange(InvariantData.dashStyles);
  99. this.colorsForm = new ColorsForm();
  100. this.colorsForm.StartPosition = FormStartPosition.CenterScreen;
  101. this.colorsForm.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  102. this.colorsForm1 = new ColorsForm();
  103. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  104. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  105. this.fontsItems.Clear();
  106. //绑定字体数据
  107. System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
  108. foreach (FontFamily fontFamily in fonts.Families)
  109. {
  110. fontsItems.Add(fontFamily.Name);
  111. }
  112. this.comboBox11.DataSource = fontsItems;
  113. UpdateRightSettingUI();
  114. }
  115. #region 初始化
  116. private void InitializeComponent()
  117. {
  118. this.comboBox91 = new System.Windows.Forms.ComboBox();
  119. this.label91 = new System.Windows.Forms.Label();
  120. this.groupBox2 = new System.Windows.Forms.GroupBox();
  121. this.comboBox5 = new System.Windows.Forms.ComboBox();
  122. this.label6 = new System.Windows.Forms.Label();
  123. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  124. this.label5 = new System.Windows.Forms.Label();
  125. this.panel3 = new System.Windows.Forms.Panel();
  126. this.comboBox4 = new System.Windows.Forms.ComboBox();
  127. this.label4 = new System.Windows.Forms.Label();
  128. this.comboBox3 = new System.Windows.Forms.ComboBox();
  129. this.label3 = new System.Windows.Forms.Label();
  130. this.panel2 = new System.Windows.Forms.Panel();
  131. this.comboBox2 = new System.Windows.Forms.ComboBox();
  132. this.label2 = new System.Windows.Forms.Label();
  133. this.numericUpDown11 = new System.Windows.Forms.NumericUpDown();
  134. this.comboBox21 = new System.Windows.Forms.ComboBox();
  135. this.numericUpDown21 = new System.Windows.Forms.NumericUpDown();
  136. this.label61 = new System.Windows.Forms.Label();
  137. this.label51 = new System.Windows.Forms.Label();
  138. this.linePanel = new System.Windows.Forms.Panel();
  139. this.label41 = new System.Windows.Forms.Label();
  140. this.textPanel = new System.Windows.Forms.Panel();
  141. this.label31 = new System.Windows.Forms.Label();
  142. this.label21 = new System.Windows.Forms.Label();
  143. this.comboBox11 = new System.Windows.Forms.ComboBox();
  144. this.label11 = new System.Windows.Forms.Label();
  145. this.groupBox1 = new System.Windows.Forms.GroupBox();
  146. this.button3 = new System.Windows.Forms.Button();
  147. this.button1 = new System.Windows.Forms.Button();
  148. this.groupBox2.SuspendLayout();
  149. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  150. this.panel3.SuspendLayout();
  151. this.panel2.SuspendLayout();
  152. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).BeginInit();
  153. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown21)).BeginInit();
  154. this.groupBox1.SuspendLayout();
  155. this.SuspendLayout();
  156. //
  157. // groupBox2
  158. //
  159. this.groupBox2.Controls.Add(this.comboBox5);
  160. this.groupBox2.Controls.Add(this.label6);
  161. this.groupBox2.Controls.Add(this.numericUpDown1);
  162. this.groupBox2.Controls.Add(this.label5);
  163. this.groupBox2.Controls.Add(this.panel3);
  164. this.groupBox2.Controls.Add(this.panel2);
  165. this.groupBox2.Controls.Add(this.numericUpDown11);
  166. this.groupBox2.Controls.Add(this.comboBox21);
  167. this.groupBox2.Controls.Add(this.numericUpDown21);
  168. this.groupBox2.Controls.Add(this.label61);
  169. this.groupBox2.Controls.Add(this.label51);
  170. this.groupBox2.Controls.Add(this.linePanel);
  171. this.groupBox2.Controls.Add(this.label41);
  172. this.groupBox2.Controls.Add(this.textPanel);
  173. this.groupBox2.Controls.Add(this.label31);
  174. this.groupBox2.Controls.Add(this.label21);
  175. this.groupBox2.Controls.Add(this.comboBox11);
  176. this.groupBox2.Controls.Add(this.label11);
  177. this.groupBox2.Controls.Add(this.comboBox91);
  178. this.groupBox2.Controls.Add(this.label91);
  179. this.groupBox2.Location = new System.Drawing.Point(10, 76);
  180. this.groupBox2.Name = "groupBox2";
  181. this.groupBox2.Size = new System.Drawing.Size(633, 235);
  182. this.groupBox2.TabIndex = 8;
  183. this.groupBox2.TabStop = false;
  184. this.groupBox2.Text = "设置";
  185. //
  186. // labe91
  187. //
  188. this.label91.AutoSize = true;
  189. this.label91.Location = new System.Drawing.Point(14, 182);
  190. this.label91.Name = "labe91";
  191. this.label91.Size = new System.Drawing.Size(89, 12);
  192. this.label91.TabIndex = 14;
  193. this.label91.Text = "角度单位:";
  194. //
  195. // comboBox91
  196. //
  197. this.comboBox91.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  198. this.comboBox91.FormattingEnabled = true;
  199. this.comboBox91.Location = new System.Drawing.Point(91, 179);
  200. this.comboBox91.Name = "comboBox91";
  201. this.comboBox91.Size = new System.Drawing.Size(152, 20);
  202. this.comboBox91.TabIndex = 15;
  203. //
  204. // comboBox5
  205. //
  206. this.comboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  207. this.comboBox5.FormattingEnabled = true;
  208. this.comboBox5.Items.AddRange(new object[] {
  209. "随线",
  210. "水平"});
  211. this.comboBox5.Location = new System.Drawing.Point(337, 46);
  212. this.comboBox5.Name = "comboBox5";
  213. this.comboBox5.Size = new System.Drawing.Size(122, 20);
  214. this.comboBox5.TabIndex = 22;
  215. //
  216. // label6
  217. //
  218. this.label6.AutoSize = true;
  219. this.label6.Location = new System.Drawing.Point(260, 50);
  220. this.label6.Name = "label6";
  221. this.label6.Size = new System.Drawing.Size(65, 12);
  222. this.label6.TabIndex = 21;
  223. this.label6.Text = "文字方向:";
  224. //
  225. // numericUpDown1
  226. //
  227. this.numericUpDown1.Location = new System.Drawing.Point(337, 21);
  228. this.numericUpDown1.Name = "numericUpDown1";
  229. this.numericUpDown1.Size = new System.Drawing.Size(152, 21);
  230. this.numericUpDown1.TabIndex = 20;
  231. //
  232. // label5
  233. //
  234. this.label5.AutoSize = true;
  235. this.label5.Location = new System.Drawing.Point(260, 25);
  236. this.label5.Name = "label5";
  237. this.label5.Size = new System.Drawing.Size(65, 12);
  238. this.label5.TabIndex = 19;
  239. this.label5.Text = "垂线长度:";
  240. //
  241. // panel3
  242. //
  243. this.panel3.Controls.Add(this.comboBox4);
  244. this.panel3.Controls.Add(this.label4);
  245. this.panel3.Controls.Add(this.comboBox3);
  246. this.panel3.Controls.Add(this.label3);
  247. this.panel3.Location = new System.Drawing.Point(9, 175);
  248. this.panel3.Name = "panel3";
  249. this.panel3.Size = new System.Drawing.Size(236, 57);
  250. this.panel3.TabIndex = 16;
  251. //
  252. // comboBox4
  253. //
  254. this.comboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  255. this.comboBox4.FormattingEnabled = true;
  256. this.comboBox4.Location = new System.Drawing.Point(112, 30);
  257. this.comboBox4.Name = "comboBox4";
  258. this.comboBox4.Size = new System.Drawing.Size(122, 20);
  259. this.comboBox4.TabIndex = 17;
  260. //
  261. // label4
  262. //
  263. this.label4.AutoSize = true;
  264. this.label4.Location = new System.Drawing.Point(5, 34);
  265. this.label4.Name = "label4";
  266. this.label4.Size = new System.Drawing.Size(89, 12);
  267. this.label4.TabIndex = 16;
  268. this.label4.Text = "文字位置(点):";
  269. //
  270. // comboBox3
  271. //
  272. this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  273. this.comboBox3.FormattingEnabled = true;
  274. this.comboBox3.Location = new System.Drawing.Point(112, 4);
  275. this.comboBox3.Name = "comboBox3";
  276. this.comboBox3.Size = new System.Drawing.Size(122, 20);
  277. this.comboBox3.TabIndex = 15;
  278. //
  279. // label3
  280. //
  281. this.label3.AutoSize = true;
  282. this.label3.Location = new System.Drawing.Point(5, 7);
  283. this.label3.Name = "label3";
  284. this.label3.Size = new System.Drawing.Size(89, 12);
  285. this.label3.TabIndex = 14;
  286. this.label3.Text = "文字位置(线):";
  287. //
  288. // panel2
  289. //
  290. this.panel2.Controls.Add(this.comboBox2);
  291. this.panel2.Controls.Add(this.label2);
  292. this.panel2.Location = new System.Drawing.Point(9, 175);
  293. this.panel2.Name = "panel2";
  294. this.panel2.Size = new System.Drawing.Size(236, 57);
  295. this.panel2.TabIndex = 15;
  296. //
  297. // comboBox2
  298. //
  299. this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  300. this.comboBox2.FormattingEnabled = true;
  301. this.comboBox2.Location = new System.Drawing.Point(82, 3);
  302. this.comboBox2.Name = "comboBox2";
  303. this.comboBox2.Size = new System.Drawing.Size(152, 20);
  304. this.comboBox2.TabIndex = 15;
  305. //
  306. // label2
  307. //
  308. this.label2.AutoSize = true;
  309. this.label2.Location = new System.Drawing.Point(5, 7);
  310. this.label2.Name = "label2";
  311. this.label2.Size = new System.Drawing.Size(0, 12);
  312. this.label2.TabIndex = 14;
  313. this.label2.Text = "文字位置:";
  314. //
  315. // numericUpDown11
  316. //
  317. this.numericUpDown11.Location = new System.Drawing.Point(91, 125);
  318. this.numericUpDown11.Name = "numericUpDown11";
  319. this.numericUpDown11.Size = new System.Drawing.Size(152, 21);
  320. this.numericUpDown11.TabIndex = 14;
  321. //
  322. // comboBox21
  323. //
  324. this.comboBox21.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  325. this.comboBox21.FormattingEnabled = true;
  326. this.comboBox21.Location = new System.Drawing.Point(91, 151);
  327. this.comboBox21.Name = "comboBox21";
  328. this.comboBox21.Size = new System.Drawing.Size(152, 20);
  329. this.comboBox21.TabIndex = 13;
  330. //
  331. // numericUpDown21
  332. //
  333. this.numericUpDown21.Location = new System.Drawing.Point(91, 46);
  334. this.numericUpDown21.Name = "numericUpDown21";
  335. this.numericUpDown21.Size = new System.Drawing.Size(152, 21);
  336. this.numericUpDown21.TabIndex = 12;
  337. //
  338. // label61
  339. //
  340. this.label61.AutoSize = true;
  341. this.label61.Location = new System.Drawing.Point(13, 155);
  342. this.label61.Name = "label61";
  343. this.label61.Size = new System.Drawing.Size(65, 12);
  344. this.label61.TabIndex = 9;
  345. this.label61.Text = "线条样式:";
  346. //
  347. // label51
  348. //
  349. this.label51.AutoSize = true;
  350. this.label51.Location = new System.Drawing.Point(13, 128);
  351. this.label51.Name = "label51";
  352. this.label51.Size = new System.Drawing.Size(65, 12);
  353. this.label51.TabIndex = 8;
  354. this.label51.Text = "线条宽度:";
  355. //
  356. // linePanel
  357. //
  358. this.linePanel.BackColor = System.Drawing.SystemColors.Window;
  359. this.linePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  360. this.linePanel.Location = new System.Drawing.Point(91, 99);
  361. this.linePanel.Name = "linePanel";
  362. this.linePanel.Size = new System.Drawing.Size(152, 20);
  363. this.linePanel.TabIndex = 7;
  364. this.linePanel.Click += new System.EventHandler(this.lineColorPanel_Click);
  365. //
  366. // label41
  367. //
  368. this.label41.AutoSize = true;
  369. this.label41.Location = new System.Drawing.Point(13, 99);
  370. this.label41.Name = "label41";
  371. this.label41.Size = new System.Drawing.Size(65, 12);
  372. this.label41.TabIndex = 6;
  373. this.label41.Text = "线条颜色:";
  374. //
  375. // textPanel
  376. //
  377. this.textPanel.BackColor = System.Drawing.SystemColors.Window;
  378. this.textPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  379. this.textPanel.Location = new System.Drawing.Point(91, 73);
  380. this.textPanel.Name = "textPanel";
  381. this.textPanel.Size = new System.Drawing.Size(152, 20);
  382. this.textPanel.TabIndex = 5;
  383. this.textPanel.Click += new System.EventHandler(this.textColorPanel_Click);
  384. //
  385. // label31
  386. //
  387. this.label31.AutoSize = true;
  388. this.label31.Location = new System.Drawing.Point(13, 76);
  389. this.label31.Name = "label31";
  390. this.label31.Size = new System.Drawing.Size(65, 12);
  391. this.label31.TabIndex = 4;
  392. this.label31.Text = "文字颜色:";
  393. //
  394. // label21
  395. //
  396. this.label21.AutoSize = true;
  397. this.label21.Location = new System.Drawing.Point(13, 50);
  398. this.label21.Name = "label21";
  399. this.label21.Size = new System.Drawing.Size(65, 12);
  400. this.label21.TabIndex = 2;
  401. this.label21.Text = "文字字号:";
  402. //
  403. // comboBox11
  404. //
  405. this.comboBox11.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  406. this.comboBox11.FormattingEnabled = true;
  407. this.comboBox11.Location = new System.Drawing.Point(91, 20);
  408. this.comboBox11.Name = "comboBox11";
  409. this.comboBox11.Size = new System.Drawing.Size(152, 20);
  410. this.comboBox11.TabIndex = 1;
  411. //
  412. // label11
  413. //
  414. this.label11.AutoSize = true;
  415. this.label11.Location = new System.Drawing.Point(13, 23);
  416. this.label11.Name = "label11";
  417. this.label11.Size = new System.Drawing.Size(65, 12);
  418. this.label11.TabIndex = 0;
  419. this.label11.Text = "文字字体:";
  420. //
  421. // groupBox1
  422. //
  423. this.groupBox1.Controls.Add(this.button3);
  424. this.groupBox1.Controls.Add(this.button1);
  425. this.groupBox1.Location = new System.Drawing.Point(12, 12);
  426. this.groupBox1.Name = "groupBox1";
  427. this.groupBox1.Size = new System.Drawing.Size(633, 58);
  428. this.groupBox1.TabIndex = 7;
  429. this.groupBox1.TabStop = false;
  430. this.groupBox1.Text = "操作";
  431. //
  432. // button3
  433. //
  434. this.button3.Location = new System.Drawing.Point(541, 20);
  435. this.button3.Name = "button3";
  436. this.button3.Size = new System.Drawing.Size(75, 23);
  437. this.button3.TabIndex = 2;
  438. this.button3.Text = "关闭";
  439. this.button3.UseVisualStyleBackColor = true;
  440. this.button3.Click += new System.EventHandler(this.button3_Click);
  441. //
  442. // button1
  443. //
  444. this.button1.Location = new System.Drawing.Point(460, 20);
  445. this.button1.Name = "button1";
  446. this.button1.Size = new System.Drawing.Size(75, 23);
  447. this.button1.TabIndex = 0;
  448. this.button1.Text = "应用";
  449. this.button1.UseVisualStyleBackColor = true;
  450. this.button1.Click += new System.EventHandler(this.button1_Click);
  451. //
  452. // MeasurementPropertiesDialog
  453. //
  454. this.ClientSize = new System.Drawing.Size(652, 319);
  455. this.Controls.Add(this.groupBox2);
  456. this.Controls.Add(this.groupBox1);
  457. this.Name = "MeasurementPropertiesDialog";
  458. this.Text = "测量属性";
  459. this.groupBox2.ResumeLayout(false);
  460. this.groupBox2.PerformLayout();
  461. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  462. this.panel3.ResumeLayout(false);
  463. this.panel3.PerformLayout();
  464. this.panel2.ResumeLayout(false);
  465. this.panel2.PerformLayout();
  466. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).EndInit();
  467. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown21)).EndInit();
  468. this.groupBox1.ResumeLayout(false);
  469. this.ResumeLayout(false);
  470. }
  471. #endregion
  472. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  473. {
  474. }
  475. private void textColorPanel_Click(object sender, EventArgs e)
  476. {
  477. this.colorsForm.UserPrimaryColor = ColorBgra.FromColor(this.textPanel.BackColor);
  478. this.colorsForm.setSaveBtn_Click(new System.EventHandler(this.textColorChanged));
  479. this.colorsForm.ShowDialog();
  480. }
  481. private void textColorChanged(object sender, EventArgs e)
  482. {
  483. this.textPanel.BackColor = this.colorsForm.UserPrimaryColor.ToColor();
  484. //this.measureStyleModel.backColor = this.colorsForm.UserPrimaryColor.ToColor().ToArgb();
  485. this.colorsForm.Close();
  486. }
  487. private void lineColorPanel_Click(object sender, EventArgs e)
  488. {
  489. this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.linePanel.BackColor);
  490. this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.lineColorChanged));
  491. this.colorsForm1.ShowDialog();
  492. }
  493. private void lineColorChanged(object sender, EventArgs e)
  494. {
  495. this.linePanel.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
  496. // this.measureStyleModel.backColor = this.colorsForm.UserPrimaryColor.ToColor().ToArgb();
  497. this.colorsForm1.Close();
  498. }
  499. /// <summary>
  500. /// 初始化属性画面
  501. /// </summary>
  502. private void UpdateRightSettingUI()
  503. {
  504. switch (this.drawObject.drawToolType)
  505. {
  506. case DrawToolType.MeasureLine: //长度测量直线
  507. MeasureStyleModel.MeasureLine measureLine = this.measureStyleModel.measureLine;
  508. this.panel2.Visible = true;
  509. this.panel3.Visible = false;
  510. this.numericUpDown1.Visible = true;
  511. this.label5.Visible = true;
  512. this.comboBox5.Visible = true;
  513. this.label6.Visible = true;
  514. this.label91.Visible = false;
  515. this.comboBox91.Visible = false;
  516. UpdataFontPosition(false);
  517. this.UpdateMeasureStyleData(measureLine.font, measureLine.fontSize, measureLine.textColor, measureLine.lineColor, measureLine.lineWidth, measureLine.lineStyle, measureLine.linePosition, 0, 0, measureLine.vLineLength,measureLine.followLine);
  518. break;
  519. case DrawToolType.MeasureDistanceLine: //长度测量距离
  520. MeasureStyleModel.MeasureDistanceLine measureDistanceLine = this.measureStyleModel.measureDistanceLine;
  521. this.panel2.Visible = true;
  522. this.panel3.Visible = false;
  523. this.numericUpDown1.Visible = false;
  524. this.label5.Visible = false;
  525. this.comboBox5.Visible = false;
  526. this.label6.Visible = false;
  527. this.label91.Visible = false;
  528. this.comboBox91.Visible = false;
  529. UpdataFontPosition(false);
  530. this.UpdateMeasureStyleData(measureDistanceLine.font, measureDistanceLine.fontSize, measureDistanceLine.textColor, measureDistanceLine.lineColor, measureDistanceLine.lineWidth, measureDistanceLine.lineStyle, measureDistanceLine.linePosition, 0, 0, -1);
  531. break;
  532. case DrawToolType.MeasureLength: //长度测量->长度
  533. MeasureStyleModel.MeasureLength measureLength = this.measureStyleModel.measureLength;
  534. this.panel2.Visible = true;
  535. this.panel3.Visible = false;
  536. this.numericUpDown1.Visible = false;
  537. this.label5.Visible = false;
  538. this.comboBox5.Visible = false;
  539. this.label6.Visible = false;
  540. this.label91.Visible = false;
  541. this.comboBox91.Visible = false;
  542. UpdataFontPosition(false);
  543. this.UpdateMeasureStyleData(measureLength.font, measureLength.fontSize, measureLength.textColor, measureLength.lineColor, measureLength.lineWidth, measureLength.lineStyle, measureLength.linePosition, 0, 0, -1);
  544. break;
  545. case DrawToolType.MeasureHLine: //长度测量->水平线
  546. MeasureStyleModel.MeasureHLine measureHLine = this.measureStyleModel.measureHLine;
  547. this.panel2.Visible = true;
  548. this.panel3.Visible = false;
  549. this.numericUpDown1.Visible = true;
  550. this.label5.Visible = true;
  551. this.comboBox5.Visible = false;
  552. this.label6.Visible = false;
  553. this.label91.Visible = false;
  554. this.comboBox91.Visible = false;
  555. UpdataFontPosition(false);
  556. this.UpdateMeasureStyleData(measureHLine.font, measureHLine.fontSize, measureHLine.textColor, measureHLine.lineColor, measureHLine.lineWidth, measureHLine.lineStyle, measureHLine.linePosition, 0, 0, measureHLine.vLineLength);
  557. break;
  558. case DrawToolType.MeasureVLine: //长度测量->垂线
  559. MeasureStyleModel.MeasureVLine measureVLine = this.measureStyleModel.measureVLine;
  560. this.panel2.Visible = true;
  561. this.panel3.Visible = false;
  562. this.numericUpDown1.Visible = true;
  563. this.label5.Visible = true;
  564. this.comboBox5.Visible = true;
  565. this.label6.Visible = true;
  566. this.label91.Visible = false;
  567. this.comboBox91.Visible = false;
  568. UpdataFontPosition(false);
  569. this.UpdateMeasureStyleData(measureVLine.font, measureVLine.fontSize, measureVLine.textColor, measureVLine.lineColor, measureVLine.lineWidth, measureVLine.lineStyle, measureVLine.linePosition, 0, 0, measureVLine.vLineLength, measureVLine.followLine);
  570. break;
  571. case DrawToolType.MeasureMulLine: //多点线段->多点直线
  572. MeasureStyleModel.MeasureMulLine measureMulLine = this.measureStyleModel.measureMulLine;
  573. this.panel3.Visible = true;
  574. this.panel2.Visible = false;
  575. this.numericUpDown1.Visible = true;
  576. this.label5.Visible = true;
  577. this.comboBox5.Visible = false;
  578. this.label6.Visible = false;
  579. this.label91.Visible = false;
  580. this.comboBox91.Visible = false;
  581. this.UpdateMeasureStyleData(measureMulLine.font, measureMulLine.fontSize, measureMulLine.textColor, measureMulLine.lineColor, measureMulLine.lineWidth, measureMulLine.lineStyle, 0, measureMulLine.linePositionL, measureMulLine.linePositionP, measureMulLine.vLineLength);
  582. break;
  583. case DrawToolType.MeasureMulHVLine: //多点线段->多点水平线
  584. MeasureStyleModel.MeasureMulHVLine measureMulHVLine = this.measureStyleModel.measureMulHVLine;
  585. this.panel3.Visible = true;
  586. this.panel2.Visible = false;
  587. this.numericUpDown1.Visible = true;
  588. this.label5.Visible = true;
  589. this.comboBox5.Visible = false;
  590. this.label6.Visible = false;
  591. this.label91.Visible = false;
  592. this.comboBox91.Visible = false;
  593. this.UpdateMeasureStyleData(measureMulHVLine.font, measureMulHVLine.fontSize, measureMulHVLine.textColor, measureMulHVLine.lineColor, measureMulHVLine.lineWidth, measureMulHVLine.lineStyle, 0, measureMulHVLine.linePositionL, measureMulHVLine.linePositionP, measureMulHVLine.vLineLength);
  594. break;
  595. case DrawToolType.MeasureMulSegment: //多点线段->多点线段
  596. MeasureStyleModel.MeasureMulSegment measureMulSegment = this.measureStyleModel.measureMulSegment;
  597. this.panel3.Visible = true;
  598. this.panel2.Visible = false;
  599. this.numericUpDown1.Visible = true;
  600. this.label5.Visible = true;
  601. this.comboBox5.Visible = false;
  602. this.label6.Visible = false;
  603. this.label91.Visible = false;
  604. this.comboBox91.Visible = false;
  605. this.UpdateMeasureStyleData(measureMulSegment.font, measureMulSegment.fontSize, measureMulSegment.textColor, measureMulSegment.lineColor, measureMulSegment.lineWidth, measureMulSegment.lineStyle, 0, measureMulSegment.linePositionL, measureMulSegment.linePositionP, measureMulSegment.vLineLength);
  606. break;
  607. case DrawToolType.MeasureMulVLine: //多点线段->多点垂直线
  608. MeasureStyleModel.MeasureMulVLine measureMulVLine = this.measureStyleModel.measureMulVLine;
  609. this.panel3.Visible = true;
  610. this.panel2.Visible = false;
  611. this.numericUpDown1.Visible = true;
  612. this.label5.Visible = true;
  613. this.comboBox5.Visible = true;
  614. this.label6.Visible = true;
  615. this.label91.Visible = false;
  616. this.comboBox91.Visible = false;
  617. this.UpdateMeasureStyleData(measureMulVLine.font, measureMulVLine.fontSize, measureMulVLine.textColor, measureMulVLine.lineColor, measureMulVLine.lineWidth, measureMulVLine.lineStyle, 0, measureMulVLine.linePositionL, measureMulVLine.linePositionP, measureMulVLine.vLineLength, measureMulVLine.followLine);
  618. break;
  619. case DrawToolType.MeasureBrokenLine: //曲线长度->折线
  620. MeasureStyleModel.MeasureBrokenLine measureBrokenLine = this.measureStyleModel.measureBrokenLine;
  621. this.panel2.Visible = true;
  622. this.panel3.Visible = false;
  623. this.numericUpDown1.Visible = false;
  624. this.label5.Visible = false;
  625. this.comboBox5.Visible = false;
  626. this.label6.Visible = false;
  627. this.label91.Visible = false;
  628. this.comboBox91.Visible = false;
  629. UpdataFontPosition(true);
  630. this.UpdateMeasureStyleData(measureBrokenLine.font, measureBrokenLine.fontSize, measureBrokenLine.textColor, measureBrokenLine.lineColor, measureBrokenLine.lineWidth, measureBrokenLine.lineStyle, measureBrokenLine.linePosition, 0, 0, -1);
  631. break;
  632. case DrawToolType.MeasureTraceCurve: //曲线长度->轨迹曲线
  633. MeasureStyleModel.MeasureTraceCurve measureTraceCurve = this.measureStyleModel.measureTraceCurve;
  634. this.panel2.Visible = true;
  635. this.panel3.Visible = false;
  636. this.numericUpDown1.Visible = false;
  637. this.label5.Visible = false;
  638. this.comboBox5.Visible = false;
  639. this.label6.Visible = false;
  640. this.label91.Visible = false;
  641. this.comboBox91.Visible = false;
  642. UpdataFontPosition(true);
  643. this.UpdateMeasureStyleData(measureTraceCurve.font, measureTraceCurve.fontSize, measureTraceCurve.textColor, measureTraceCurve.lineColor, measureTraceCurve.lineWidth, measureTraceCurve.lineStyle, measureTraceCurve.linePosition, 0, 0, -1);
  644. break;
  645. case DrawToolType.MeasureCurveLine: //曲线长度->曲线
  646. MeasureStyleModel.MeasureCurveLine measureCurveLine = this.measureStyleModel.measureCurveLine;
  647. this.panel2.Visible = true;
  648. this.panel3.Visible = false;
  649. this.numericUpDown1.Visible = false;
  650. this.label5.Visible = false;
  651. this.comboBox5.Visible = false;
  652. this.label6.Visible = false;
  653. this.label91.Visible = false;
  654. this.comboBox91.Visible = false;
  655. UpdataFontPosition(true);
  656. this.UpdateMeasureStyleData(measureCurveLine.font, measureCurveLine.fontSize, measureCurveLine.textColor, measureCurveLine.lineColor, measureCurveLine.lineWidth, measureCurveLine.lineStyle, measureCurveLine.linePosition, 0, 0, -1);
  657. break;
  658. case DrawToolType.MeasurePLine: //点垂线->点垂线
  659. MeasureStyleModel.MeasurePLine measurePLine = this.measureStyleModel.measurePLine;
  660. this.panel3.Visible = true;
  661. this.panel2.Visible = false;
  662. this.numericUpDown1.Visible = false;
  663. this.label5.Visible = false;
  664. this.comboBox5.Visible = false;
  665. this.label6.Visible = false;
  666. this.label91.Visible = false;
  667. this.comboBox91.Visible = false;
  668. this.UpdateMeasureStyleData(measurePLine.font, measurePLine.fontSize, measurePLine.textColor, measurePLine.lineColor, measurePLine.lineWidth, measurePLine.lineStyle, 0, measurePLine.linePositionL, measurePLine.linePositionP, -1);
  669. break;
  670. case DrawToolType.MeasureMulPLine: //点垂线->多点垂线
  671. MeasureStyleModel.MeasureMulPLine measureMulPLine = this.measureStyleModel.measureMulPLine;
  672. this.panel3.Visible = true;
  673. this.panel2.Visible = false;
  674. this.numericUpDown1.Visible = false;
  675. this.label5.Visible = false;
  676. this.comboBox5.Visible = false;
  677. this.label6.Visible = false;
  678. this.label91.Visible = false;
  679. this.comboBox91.Visible = false;
  680. this.UpdateMeasureStyleData(measureMulPLine.font, measureMulPLine.fontSize, measureMulPLine.textColor, measureMulPLine.lineColor, measureMulPLine.lineWidth, measureMulPLine.lineStyle, 0, measureMulPLine.linePositionL, measureMulPLine.linePositionP, -1);
  681. break;
  682. case DrawToolType.MeasureHMulPLine: //点垂线->水平多点垂线
  683. MeasureStyleModel.MeasureHMulPLine measureHMulPLine = this.measureStyleModel.measureHMulPLine;
  684. this.panel3.Visible = true;
  685. this.panel2.Visible = false;
  686. this.numericUpDown1.Visible = false;
  687. this.label5.Visible = false;
  688. this.comboBox5.Visible = false;
  689. this.label6.Visible = false;
  690. this.label91.Visible = false;
  691. this.comboBox91.Visible = false;
  692. this.UpdateMeasureStyleData(measureHMulPLine.font, measureHMulPLine.fontSize, measureHMulPLine.textColor, measureHMulPLine.lineColor, measureHMulPLine.lineWidth, measureHMulPLine.lineStyle, 0, measureHMulPLine.linePositionL, measureHMulPLine.linePositionP, -1);
  693. break;
  694. case DrawToolType.MeasureVMulPLine: //点垂线->垂直多点垂线
  695. MeasureStyleModel.MeasureVMulPLine measureVMulPLine = this.measureStyleModel.measureVMulPLine;
  696. this.panel3.Visible = true;
  697. this.panel2.Visible = false;
  698. this.numericUpDown1.Visible = false;
  699. this.label5.Visible = false;
  700. this.comboBox5.Visible = false;
  701. this.label6.Visible = false;
  702. this.label91.Visible = false;
  703. this.comboBox91.Visible = false;
  704. this.UpdateMeasureStyleData(measureVMulPLine.font, measureVMulPLine.fontSize, measureVMulPLine.textColor, measureVMulPLine.lineColor, measureVMulPLine.lineWidth, measureVMulPLine.lineStyle, 0, measureVMulPLine.linePositionL, measureVMulPLine.linePositionP, -1);
  705. break;
  706. case DrawToolType.MeasurePointHLine: //点垂线->点到水平线距离
  707. MeasureStyleModel.MeasurePointHLine measurePointHLine = this.measureStyleModel.measurePointHLine;
  708. this.panel3.Visible = true;
  709. this.panel2.Visible = false;
  710. this.numericUpDown1.Visible = false;
  711. this.label5.Visible = false;
  712. this.comboBox5.Visible = false;
  713. this.label6.Visible = false;
  714. this.label91.Visible = false;
  715. this.comboBox91.Visible = false;
  716. this.UpdateMeasureStyleData(measurePointHLine.font, measurePointHLine.fontSize, measurePointHLine.textColor, measurePointHLine.lineColor, measurePointHLine.lineWidth, measurePointHLine.lineStyle, 0, measurePointHLine.linePositionL, measurePointHLine.linePositionP, -1);
  717. break;
  718. case DrawToolType.MeasureParallelLine: //平行线测量->平行线
  719. MeasureStyleModel.MeasureParallelLine measureParallelLine = this.measureStyleModel.measureParallelLine;
  720. this.panel3.Visible = true;
  721. this.panel2.Visible = false;
  722. this.numericUpDown1.Visible = false;
  723. this.label5.Visible = false;
  724. this.comboBox5.Visible = true;
  725. this.label6.Visible = true;
  726. this.label91.Visible = false;
  727. this.comboBox91.Visible = false;
  728. this.UpdateMeasureStyleData(measureParallelLine.font, measureParallelLine.fontSize, measureParallelLine.textColor, measureParallelLine.lineColor, measureParallelLine.lineWidth, measureParallelLine.lineStyle, 0, measureParallelLine.linePositionL, measureParallelLine.linePositionP, -1, measureParallelLine.followLine);
  729. break;
  730. case DrawToolType.MeasureMulParallelLine: //平行线测量->多点平行线
  731. MeasureStyleModel.MeasureMulParallelLine measureMulParallelLine = this.measureStyleModel.measureMulParallelLine;
  732. this.panel3.Visible = true;
  733. this.panel2.Visible = false;
  734. this.numericUpDown1.Visible = false;
  735. this.label5.Visible = false;
  736. this.comboBox5.Visible = false;
  737. this.label6.Visible = false;
  738. this.label91.Visible = false;
  739. this.comboBox91.Visible = false;
  740. this.UpdateMeasureStyleData(measureMulParallelLine.font, measureMulParallelLine.fontSize, measureMulParallelLine.textColor, measureMulParallelLine.lineColor, measureMulParallelLine.lineWidth, measureMulParallelLine.lineStyle, 0, measureMulParallelLine.linePositionL, measureMulParallelLine.linePositionP, -1);
  741. break;
  742. case DrawToolType.MeasureVMulParallelLine: //平行线测量->垂直多点平行线
  743. MeasureStyleModel.MeasureVMulParallelLine measureVMulParallelLine = this.measureStyleModel.measureVMulParallelLine;
  744. this.panel3.Visible = true;
  745. this.panel2.Visible = false;
  746. this.numericUpDown1.Visible = false;
  747. this.label5.Visible = false;
  748. this.comboBox5.Visible = false;
  749. this.label6.Visible = false;
  750. this.label91.Visible = false;
  751. this.comboBox91.Visible = false;
  752. this.UpdateMeasureStyleData(measureVMulParallelLine.font, measureVMulParallelLine.fontSize, measureVMulParallelLine.textColor, measureVMulParallelLine.lineColor, measureVMulParallelLine.lineWidth, measureVMulParallelLine.lineStyle, 0, measureVMulParallelLine.linePositionL, measureVMulParallelLine.linePositionP, -1);
  753. break;
  754. case DrawToolType.MeasureHMulParallelLine: //平行线测量->水平多点平行线
  755. MeasureStyleModel.MeasureHMulParallelLine measureHMulParallelLine = this.measureStyleModel.measureHMulParallelLine;
  756. this.panel3.Visible = true;
  757. this.panel2.Visible = false;
  758. this.numericUpDown1.Visible = false;
  759. this.label5.Visible = false;
  760. this.comboBox5.Visible = false;
  761. this.label6.Visible = false;
  762. this.label91.Visible = false;
  763. this.comboBox91.Visible = false;
  764. this.UpdateMeasureStyleData(measureHMulParallelLine.font, measureHMulParallelLine.fontSize, measureHMulParallelLine.textColor, measureHMulParallelLine.lineColor, measureHMulParallelLine.lineWidth, measureHMulParallelLine.lineStyle, 0, measureHMulParallelLine.linePositionL, measureHMulParallelLine.linePositionP, -1);
  765. break;
  766. case DrawToolType.MeasureClosedCurve: //多边形测量->闭合曲线
  767. MeasureStyleModel.MeasureClosedCurve measureClosedCurve = this.measureStyleModel.measureClosedCurve;
  768. this.panel3.Visible = false;
  769. this.panel2.Visible = false;
  770. this.numericUpDown1.Visible = false;
  771. this.label5.Visible = false;
  772. this.comboBox5.Visible = false;
  773. this.label6.Visible = false;
  774. this.label91.Visible = false;
  775. this.comboBox91.Visible = false;
  776. this.UpdateMeasureStyleData(measureClosedCurve.font, measureClosedCurve.fontSize, measureClosedCurve.textColor, measureClosedCurve.lineColor, measureClosedCurve.lineWidth, measureClosedCurve.lineStyle, 0, 0, 0, -1);
  777. break;
  778. case DrawToolType.MeasurePolygon: //多边形测量->多边形
  779. MeasureStyleModel.MeasurePolygon measurePolygon = this.measureStyleModel.measurePolygon;
  780. this.panel3.Visible = false;
  781. this.panel2.Visible = false;
  782. this.numericUpDown1.Visible = false;
  783. this.label5.Visible = false;
  784. this.comboBox5.Visible = false;
  785. this.label6.Visible = false;
  786. this.label91.Visible = false;
  787. this.comboBox91.Visible = false;
  788. this.UpdateMeasureStyleData(measurePolygon.font, measurePolygon.fontSize, measurePolygon.textColor, measurePolygon.lineColor, measurePolygon.lineWidth, measurePolygon.lineStyle, 0, 0, 0, -1);
  789. break;
  790. case DrawToolType.MeasureRectangle: //多边形测量->矩形
  791. MeasureStyleModel.MeasureRectangle measureRectangle = this.measureStyleModel.measureRectangle;
  792. this.panel3.Visible = false;
  793. this.panel2.Visible = false;
  794. this.numericUpDown1.Visible = false;
  795. this.label5.Visible = false;
  796. this.comboBox5.Visible = false;
  797. this.label6.Visible = false;
  798. this.label91.Visible = false;
  799. this.comboBox91.Visible = false;
  800. this.UpdateMeasureStyleData(measureRectangle.font, measureRectangle.fontSize, measureRectangle.textColor, measureRectangle.lineColor, measureRectangle.lineWidth, measureRectangle.lineStyle, 0, 0, 0, -1);
  801. break;
  802. case DrawToolType.MeasureRandRectangle: //多边形测量->任意矩形
  803. MeasureStyleModel.MeasureRandRectangle measureRandRectangle = this.measureStyleModel.measureRandRectangle;
  804. this.panel3.Visible = false;
  805. this.panel2.Visible = false;
  806. this.numericUpDown1.Visible = false;
  807. this.label5.Visible = false;
  808. this.comboBox5.Visible = false;
  809. this.label6.Visible = false;
  810. this.label91.Visible = false;
  811. this.comboBox91.Visible = false;
  812. this.UpdateMeasureStyleData(measureRandRectangle.font, measureRandRectangle.fontSize, measureRandRectangle.textColor, measureRandRectangle.lineColor, measureRandRectangle.lineWidth, measureRandRectangle.lineStyle, 0, 0, 0, -1);
  813. break;
  814. case DrawToolType.MeasureSquare: //多边形测量->正方形
  815. MeasureStyleModel.MeasureSquare measureSquare = this.measureStyleModel.measureSquare;
  816. this.panel3.Visible = false;
  817. this.panel2.Visible = false;
  818. this.numericUpDown1.Visible = false;
  819. this.label5.Visible = false;
  820. this.comboBox5.Visible = false;
  821. this.label6.Visible = false;
  822. this.label91.Visible = false;
  823. this.comboBox91.Visible = false;
  824. this.UpdateMeasureStyleData(measureSquare.font, measureSquare.fontSize, measureSquare.textColor, measureSquare.lineColor, measureSquare.lineWidth, measureSquare.lineStyle, 0, 0, 0, -1);
  825. break;
  826. case DrawToolType.MeasureRandSquare: //多边形测量->任意正方形
  827. MeasureStyleModel.MeasureRandSquare measureRandSquare = this.measureStyleModel.measureRandSquare;
  828. this.panel3.Visible = false;
  829. this.panel2.Visible = false;
  830. this.numericUpDown1.Visible = false;
  831. this.label5.Visible = false;
  832. this.comboBox5.Visible = false;
  833. this.label6.Visible = false;
  834. this.label91.Visible = false;
  835. this.comboBox91.Visible = false;
  836. this.UpdateMeasureStyleData(measureRandSquare.font, measureRandSquare.fontSize, measureRandSquare.textColor, measureRandSquare.lineColor, measureRandSquare.lineWidth, measureRandSquare.lineStyle, 0, 0, 0, -1);
  837. break;
  838. case DrawToolType.MeasureTracePolygon: //多边形测量->轨迹多边形
  839. MeasureStyleModel.MeasureTracePolygon measureTracePolygon = this.measureStyleModel.measureTracePolygon;
  840. this.panel3.Visible = false;
  841. this.panel2.Visible = false;
  842. this.numericUpDown1.Visible = false;
  843. this.label5.Visible = false;
  844. this.comboBox5.Visible = false;
  845. this.label6.Visible = false;
  846. this.label91.Visible = false;
  847. this.comboBox91.Visible = false;
  848. this.UpdateMeasureStyleData(measureTracePolygon.font, measureTracePolygon.fontSize, measureTracePolygon.textColor, measureTracePolygon.lineColor, measureTracePolygon.lineWidth, measureTracePolygon.lineStyle, 0, 0, 0, -1);
  849. break;
  850. case DrawToolType.MeasureCircle: //圆形测量->三点圆
  851. MeasureStyleModel.MeasureCircle measureCircle = this.measureStyleModel.measureCircle;
  852. this.panel3.Visible = false;
  853. this.panel2.Visible = false;
  854. this.numericUpDown1.Visible = false;
  855. this.label5.Visible = false;
  856. this.comboBox5.Visible = false;
  857. this.label6.Visible = false;
  858. this.label91.Visible = false;
  859. this.comboBox91.Visible = false;
  860. this.UpdateMeasureStyleData(measureCircle.font, measureCircle.fontSize, measureCircle.textColor, measureCircle.lineColor, measureCircle.lineWidth, measureCircle.lineStyle, 0, 0, 0, -1);
  861. break;
  862. case DrawToolType.MeasureInnerCircle: //圆形测量->向内画圆
  863. MeasureStyleModel.MeasureInnerCircle measureInnerCircle = this.measureStyleModel.measureInnerCircle;
  864. this.panel3.Visible = false;
  865. this.panel2.Visible = false;
  866. this.numericUpDown1.Visible = false;
  867. this.label5.Visible = false;
  868. this.comboBox5.Visible = false;
  869. this.label6.Visible = false;
  870. this.label91.Visible = false;
  871. this.comboBox91.Visible = false;
  872. this.UpdateMeasureStyleData(measureInnerCircle.font, measureInnerCircle.fontSize, measureInnerCircle.textColor, measureInnerCircle.lineColor, measureInnerCircle.lineWidth, measureInnerCircle.lineStyle, 0, 0, 0, -1);
  873. break;
  874. case DrawToolType.MeasureOuterCircle: //圆形测量->向外画圆
  875. MeasureStyleModel.MeasureOuterCircle measureOuterCircle = this.measureStyleModel.measureOuterCircle;
  876. this.panel3.Visible = false;
  877. this.panel2.Visible = false;
  878. this.numericUpDown1.Visible = false;
  879. this.label5.Visible = false;
  880. this.comboBox5.Visible = false;
  881. this.label6.Visible = false;
  882. this.label91.Visible = false;
  883. this.comboBox91.Visible = false;
  884. this.UpdateMeasureStyleData(measureOuterCircle.font, measureOuterCircle.fontSize, measureOuterCircle.textColor, measureOuterCircle.lineColor, measureOuterCircle.lineWidth, measureOuterCircle.lineStyle, 0, 0, 0, -1);
  885. break;
  886. case DrawToolType.MeasureDiameterCircle: //圆形测量->直径画圆
  887. MeasureStyleModel.MeasureDiameterCircle measureDiameterCircle = this.measureStyleModel.measureDiameterCircle;
  888. this.panel3.Visible = false;
  889. this.panel2.Visible = false;
  890. this.numericUpDown1.Visible = false;
  891. this.label5.Visible = false;
  892. this.comboBox5.Visible = false;
  893. this.label6.Visible = false;
  894. this.label91.Visible = false;
  895. this.comboBox91.Visible = false;
  896. this.UpdateMeasureStyleData(measureDiameterCircle.font, measureDiameterCircle.fontSize, measureDiameterCircle.textColor, measureDiameterCircle.lineColor, measureDiameterCircle.lineWidth, measureDiameterCircle.lineStyle, 0, 0, 0, -1);
  897. break;
  898. case DrawToolType.MeasurePointEdgeSize: //圆形测量->点到圆距离
  899. MeasureStyleModel.MeasurePointEdgeSize measurePointEdgeSize = this.measureStyleModel.measurePointEdgeSize;
  900. this.panel3.Visible = false;
  901. this.panel2.Visible = false;
  902. this.numericUpDown1.Visible = false;
  903. this.label5.Visible = false;
  904. this.comboBox5.Visible = false;
  905. this.label6.Visible = false;
  906. this.label91.Visible = false;
  907. this.comboBox91.Visible = false;
  908. this.UpdateMeasureStyleData(measurePointEdgeSize.font, measurePointEdgeSize.fontSize, measurePointEdgeSize.textColor, measurePointEdgeSize.lineColor, measurePointEdgeSize.lineWidth, measurePointEdgeSize.lineStyle, 0, 0, 0, -1);
  909. break;
  910. case DrawToolType.MeasurePointCenterSize: //圆形测量->点到圆心距离
  911. MeasureStyleModel.MeasurePointCenterSize measurePointCenterSize = this.measureStyleModel.measurePointCenterSize;
  912. this.panel3.Visible = false;
  913. this.panel2.Visible = false;
  914. this.numericUpDown1.Visible = false;
  915. this.label5.Visible = false;
  916. this.comboBox5.Visible = false;
  917. this.label6.Visible = false;
  918. this.label91.Visible = false;
  919. this.comboBox91.Visible = false;
  920. this.UpdateMeasureStyleData(measurePointCenterSize.font, measurePointCenterSize.fontSize, measurePointCenterSize.textColor, measurePointCenterSize.lineColor, measurePointCenterSize.lineWidth, measurePointCenterSize.lineStyle, 0, 0, 0, -1);
  921. break;
  922. case DrawToolType.MeasurePointArcSize: //圆形测量->点到圆弧距离
  923. MeasureStyleModel.MeasurePointArcSize measurePointArcSize = this.measureStyleModel.measurePointArcSize;
  924. this.panel3.Visible = false;
  925. this.panel2.Visible = false;
  926. this.numericUpDown1.Visible = false;
  927. this.label5.Visible = false;
  928. this.comboBox5.Visible = false;
  929. this.label6.Visible = false;
  930. this.label91.Visible = false;
  931. this.comboBox91.Visible = false;
  932. this.UpdateMeasureStyleData(measurePointArcSize.font, measurePointArcSize.fontSize, measurePointArcSize.textColor, measurePointArcSize.lineColor, measurePointArcSize.lineWidth, measurePointArcSize.lineStyle, 0, 0, 0, -1);
  933. break;
  934. case DrawToolType.MeasureThreePointAngle: //角度测量->三点角度
  935. MeasureStyleModel.MeasureThreePointAngle measureThreePointAngle = this.measureStyleModel.measureThreePointAngle;
  936. this.panel3.Visible = false;
  937. this.panel2.Visible = false;
  938. this.numericUpDown1.Visible = false;
  939. this.label5.Visible = false;
  940. this.comboBox5.Visible = false;
  941. this.label6.Visible = false;
  942. this.label91.Visible = true;
  943. this.comboBox91.Visible = true;
  944. this.UpdateMeasureStyleData(measureThreePointAngle.font, measureThreePointAngle.fontSize, measureThreePointAngle.textColor, measureThreePointAngle.lineColor, measureThreePointAngle.lineWidth, measureThreePointAngle.lineStyle, 0, 0, 0, -1,false, measureThreePointAngle.isAngle);
  945. break;
  946. case DrawToolType.MeasureFourPointAngle: //角度测量->四点角度
  947. MeasureStyleModel.MeasureFourPointAngle measureFourPointAngle = this.measureStyleModel.measureFourPointAngle;
  948. this.panel3.Visible = false;
  949. this.panel2.Visible = false;
  950. this.numericUpDown1.Visible = false;
  951. this.label5.Visible = false;
  952. this.comboBox5.Visible = false;
  953. this.label6.Visible = false;
  954. this.label91.Visible = true;
  955. this.comboBox91.Visible = true;
  956. this.UpdateMeasureStyleData(measureFourPointAngle.font, measureFourPointAngle.fontSize, measureFourPointAngle.textColor, measureFourPointAngle.lineColor, measureFourPointAngle.lineWidth, measureFourPointAngle.lineStyle, 0, 0, 0, -1, false, measureFourPointAngle.isAngle);
  957. break;
  958. case DrawToolType.MeasureThreePointArc: //角度测量->三点弧
  959. MeasureStyleModel.MeasureThreePointArc measureThreePointArc = this.measureStyleModel.measureThreePointArc;
  960. this.panel3.Visible = false;
  961. this.panel2.Visible = false;
  962. this.numericUpDown1.Visible = false;
  963. this.label5.Visible = false;
  964. this.comboBox5.Visible = false;
  965. this.label6.Visible = false;
  966. this.label91.Visible = true;
  967. this.comboBox91.Visible = true;
  968. this.UpdateMeasureStyleData(measureThreePointArc.font, measureThreePointArc.fontSize, measureThreePointArc.textColor, measureThreePointArc.lineColor, measureThreePointArc.lineWidth, measureThreePointArc.lineStyle, 0, 0, 0, -1, false, measureThreePointArc.isAngle);
  969. break;
  970. case DrawToolType.MeasureCenterCenterSize: //对准度测量->圆心到圆心距离
  971. MeasureStyleModel.MeasureCenterCenterSize measureCenterCenterSize = this.measureStyleModel.measureCenterCenterSize;
  972. this.panel3.Visible = false;
  973. this.panel2.Visible = true;
  974. this.numericUpDown1.Visible = false;
  975. this.label5.Visible = false;
  976. this.comboBox5.Visible = false;
  977. this.label6.Visible = false;
  978. this.label91.Visible = false;
  979. this.comboBox91.Visible = false;
  980. UpdataFontPosition(false);
  981. this.UpdateMeasureStyleData(measureCenterCenterSize.font, measureCenterCenterSize.fontSize, measureCenterCenterSize.textColor, measureCenterCenterSize.lineColor, measureCenterCenterSize.lineWidth, measureCenterCenterSize.lineStyle, measureCenterCenterSize.linePosition, 0, 0, -1);
  982. break;
  983. case DrawToolType.MeasureTwoLineVLDistance: //对准度测量->两线中垂线距离
  984. MeasureStyleModel.MeasureTwoLineVLDistance measureTwoLineVLDistance = this.measureStyleModel.measureTwoLineVLDistance;
  985. this.panel3.Visible = false;
  986. this.panel2.Visible = true;
  987. this.numericUpDown1.Visible = false;
  988. this.label5.Visible = false;
  989. this.comboBox5.Visible = false;
  990. this.label6.Visible = false;
  991. this.label91.Visible = false;
  992. this.comboBox91.Visible = false;
  993. UpdataFontPosition(false);
  994. this.UpdateMeasureStyleData(measureTwoLineVLDistance.font, measureTwoLineVLDistance.fontSize, measureTwoLineVLDistance.textColor, measureTwoLineVLDistance.lineColor, measureTwoLineVLDistance.lineWidth, measureTwoLineVLDistance.lineStyle, measureTwoLineVLDistance.linePosition, 0, 0, -1);
  995. break;
  996. }
  997. }
  998. private void UpdataFontPosition(bool curve)
  999. {
  1000. List<string> position = new List<string> { PdnResources.GetString("Menu.Upperleft.text")
  1001. , PdnResources.GetString("Menu.Uppermiddle.Text")
  1002. , PdnResources.GetString("Menu.Upperright.text")
  1003. , PdnResources.GetString("Menu.Lowerleft.text")
  1004. , PdnResources.GetString("Menu.Themiddleandlower.Text")
  1005. , PdnResources.GetString("Menu.Lowerright.text")};
  1006. List<string> position1 = new List<string> { PdnResources.GetString("Menu.hestartingpoint.Text")
  1007. , PdnResources.GetString("Menu.Theendpoint.Text")
  1008. };
  1009. this.comboBox2.DataSource = null;
  1010. if (curve)
  1011. this.comboBox2.DataSource = position1;
  1012. else
  1013. this.comboBox2.DataSource = position;
  1014. }
  1015. /// <summary>
  1016. /// 更新显示区域控件的数值
  1017. /// </summary>
  1018. /// <param name="font"></param>
  1019. /// <param name="fontSize"></param>
  1020. /// <param name="textColor"></param>
  1021. /// <param name="lineColor"></param>
  1022. /// <param name="lineWidth"></param>
  1023. /// <param name="lineStyle"></param>
  1024. private void UpdateMeasureStyleData(string font, int fontSize, int textColor, int lineColor, int lineWidth, int lineStyle, int linePosition, int linePositionL, int linePositionP, int vLineLength, bool followLine = false, bool isAngle = false)
  1025. {
  1026. //绑定样式默认数据
  1027. this.comboBox11.Text = font;
  1028. this.numericUpDown21.Value = fontSize;
  1029. this.textPanel.BackColor = Color.FromArgb(textColor);
  1030. this.linePanel.BackColor = Color.FromArgb(lineColor);
  1031. this.numericUpDown11.Value = lineWidth;
  1032. this.comboBox21.SelectedIndex = lineStyle;
  1033. if (this.comboBox2.Items.Count > 0)
  1034. this.comboBox2.SelectedIndex = linePosition;
  1035. if (this.comboBox3.Items.Count > 0)
  1036. this.comboBox3.SelectedIndex = linePositionL;
  1037. if (this.comboBox4.Items.Count > 0)
  1038. this.comboBox4.SelectedIndex = linePositionP;
  1039. if(vLineLength > -1)
  1040. this.numericUpDown1.Value = vLineLength;
  1041. if (followLine)
  1042. {
  1043. this.comboBox5.SelectedIndex = 0;
  1044. }
  1045. else
  1046. {
  1047. this.comboBox5.SelectedIndex = 1;
  1048. }
  1049. this.comboBox91.SelectedIndex = isAngle ? 1 : 0;
  1050. }
  1051. /// <summary>
  1052. /// 保存
  1053. /// </summary>
  1054. private void button2_Click()
  1055. {
  1056. //调用检查类型
  1057. this.checkSaveModel();
  1058. //以下保存xml文件信息
  1059. string stageModelXml = XmlSerializeHelper.XmlSerialize<MeasureStyleModel>(this.measureStyleModel);
  1060. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Measure\\" + "Default" + ".xml";
  1061. FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
  1062. }
  1063. /// <summary>
  1064. /// 检查保存类型
  1065. /// </summary>
  1066. private void checkSaveModel()
  1067. {
  1068. string font = comboBox11.Text;
  1069. int fontSize = Convert.ToInt32(numericUpDown21.Value);
  1070. int textColor = Convert.ToInt32(this.textPanel.BackColor.ToArgb());
  1071. int lineColor = Convert.ToInt32(this.linePanel.BackColor.ToArgb());
  1072. int lineWidth = Convert.ToInt32(numericUpDown11.Value);
  1073. int lineStyle = this.comboBox21.SelectedIndex;
  1074. int linePosition = this.comboBox2.SelectedIndex;
  1075. int linePositionL = this.comboBox3.SelectedIndex;
  1076. int linePositionP = this.comboBox4.SelectedIndex;
  1077. int vLineLength = Convert.ToInt32(this.numericUpDown1.Value);
  1078. bool isAngle = comboBox91.SelectedIndex == 0 ? false : true;
  1079. switch (this.drawObject.drawToolType)
  1080. {
  1081. case DrawToolType.MeasureLine: //长度测量直线
  1082. this.measureStyleModel.measureLine.font = font;
  1083. this.measureStyleModel.measureLine.fontSize = fontSize;
  1084. this.measureStyleModel.measureLine.textColor = textColor;
  1085. this.measureStyleModel.measureLine.lineColor = lineColor;
  1086. this.measureStyleModel.measureLine.lineWidth = lineWidth;
  1087. this.measureStyleModel.measureLine.lineStyle = lineStyle;
  1088. this.measureStyleModel.measureLine.linePosition = linePosition;
  1089. this.measureStyleModel.measureLine.vLineLength = vLineLength;
  1090. this.measureStyleModel.measureLine.followLine = this.comboBox5.SelectedIndex == 0 ? true : false;
  1091. break;
  1092. case DrawToolType.MeasureDistanceLine: //长度测量距离
  1093. this.measureStyleModel.measureDistanceLine.font = font;
  1094. this.measureStyleModel.measureDistanceLine.fontSize = fontSize;
  1095. this.measureStyleModel.measureDistanceLine.textColor = textColor;
  1096. this.measureStyleModel.measureDistanceLine.lineColor = lineColor;
  1097. this.measureStyleModel.measureDistanceLine.lineWidth = lineWidth;
  1098. this.measureStyleModel.measureDistanceLine.lineStyle = lineStyle;
  1099. this.measureStyleModel.measureDistanceLine.linePosition = linePosition;
  1100. break;
  1101. case DrawToolType.MeasureLength: //长度测量->长度
  1102. this.measureStyleModel.measureLength.font = font;
  1103. this.measureStyleModel.measureLength.fontSize = fontSize;
  1104. this.measureStyleModel.measureLength.textColor = textColor;
  1105. this.measureStyleModel.measureLength.lineColor = lineColor;
  1106. this.measureStyleModel.measureLength.lineWidth = lineWidth;
  1107. this.measureStyleModel.measureLength.lineStyle = lineStyle;
  1108. this.measureStyleModel.measureLength.linePosition = linePosition;
  1109. break;
  1110. case DrawToolType.MeasureHLine: //长度测量->水平线
  1111. this.measureStyleModel.measureHLine.font = font;
  1112. this.measureStyleModel.measureHLine.fontSize = fontSize;
  1113. this.measureStyleModel.measureHLine.textColor = textColor;
  1114. this.measureStyleModel.measureHLine.lineColor = lineColor;
  1115. this.measureStyleModel.measureHLine.lineWidth = lineWidth;
  1116. this.measureStyleModel.measureHLine.lineStyle = lineStyle;
  1117. this.measureStyleModel.measureHLine.linePosition = linePosition;
  1118. this.measureStyleModel.measureHLine.vLineLength = vLineLength;
  1119. break;
  1120. case DrawToolType.MeasureVLine: //长度测量->垂线
  1121. this.measureStyleModel.measureVLine.font = font;
  1122. this.measureStyleModel.measureVLine.fontSize = fontSize;
  1123. this.measureStyleModel.measureVLine.textColor = textColor;
  1124. this.measureStyleModel.measureVLine.lineColor = lineColor;
  1125. this.measureStyleModel.measureVLine.lineWidth = lineWidth;
  1126. this.measureStyleModel.measureVLine.lineStyle = lineStyle;
  1127. this.measureStyleModel.measureVLine.linePosition = linePosition;
  1128. this.measureStyleModel.measureVLine.vLineLength = vLineLength;
  1129. this.measureStyleModel.measureVLine.followLine = this.comboBox5.SelectedIndex == 0 ? true : false;
  1130. break;
  1131. case DrawToolType.MeasureMulLine: //多点线段->多点直线
  1132. this.measureStyleModel.measureMulLine.font = font;
  1133. this.measureStyleModel.measureMulLine.fontSize = fontSize;
  1134. this.measureStyleModel.measureMulLine.textColor = textColor;
  1135. this.measureStyleModel.measureMulLine.lineColor = lineColor;
  1136. this.measureStyleModel.measureMulLine.lineWidth = lineWidth;
  1137. this.measureStyleModel.measureMulLine.lineStyle = lineStyle;
  1138. this.measureStyleModel.measureMulLine.linePositionL = linePositionL;
  1139. this.measureStyleModel.measureMulLine.linePositionP = linePositionP;
  1140. this.measureStyleModel.measureMulLine.vLineLength = vLineLength;
  1141. break;
  1142. case DrawToolType.MeasureMulHVLine: //多点线段->多点水平线
  1143. this.measureStyleModel.measureMulHVLine.font = font;
  1144. this.measureStyleModel.measureMulHVLine.fontSize = fontSize;
  1145. this.measureStyleModel.measureMulHVLine.textColor = textColor;
  1146. this.measureStyleModel.measureMulHVLine.lineColor = lineColor;
  1147. this.measureStyleModel.measureMulHVLine.lineWidth = lineWidth;
  1148. this.measureStyleModel.measureMulHVLine.lineStyle = lineStyle;
  1149. this.measureStyleModel.measureMulHVLine.linePositionL = linePositionL;
  1150. this.measureStyleModel.measureMulHVLine.linePositionP = linePositionP;
  1151. this.measureStyleModel.measureMulHVLine.vLineLength = vLineLength;
  1152. break;
  1153. case DrawToolType.MeasureMulSegment: //多点线段->多点线段
  1154. this.measureStyleModel.measureMulSegment.font = font;
  1155. this.measureStyleModel.measureMulSegment.fontSize = fontSize;
  1156. this.measureStyleModel.measureMulSegment.textColor = textColor;
  1157. this.measureStyleModel.measureMulSegment.lineColor = lineColor;
  1158. this.measureStyleModel.measureMulSegment.lineWidth = lineWidth;
  1159. this.measureStyleModel.measureMulSegment.lineStyle = lineStyle;
  1160. this.measureStyleModel.measureMulSegment.linePositionL = linePositionL;
  1161. this.measureStyleModel.measureMulSegment.linePositionP = linePositionP;
  1162. this.measureStyleModel.measureMulSegment.vLineLength = vLineLength;
  1163. break;
  1164. case DrawToolType.MeasureMulVLine: //多点线段->多点垂直线
  1165. this.measureStyleModel.measureMulVLine.font = font;
  1166. this.measureStyleModel.measureMulVLine.fontSize = fontSize;
  1167. this.measureStyleModel.measureMulVLine.textColor = textColor;
  1168. this.measureStyleModel.measureMulVLine.lineColor = lineColor;
  1169. this.measureStyleModel.measureMulVLine.lineWidth = lineWidth;
  1170. this.measureStyleModel.measureMulVLine.lineStyle = lineStyle;
  1171. this.measureStyleModel.measureMulVLine.linePositionL = linePositionL;
  1172. this.measureStyleModel.measureMulVLine.linePositionP = linePositionP;
  1173. this.measureStyleModel.measureMulVLine.vLineLength = vLineLength;
  1174. this.measureStyleModel.measureMulVLine.followLine = this.comboBox5.SelectedIndex == 0 ? true : false;
  1175. break;
  1176. case DrawToolType.MeasureBrokenLine: //曲线长度->折线
  1177. this.measureStyleModel.measureBrokenLine.font = font;
  1178. this.measureStyleModel.measureBrokenLine.fontSize = fontSize;
  1179. this.measureStyleModel.measureBrokenLine.textColor = textColor;
  1180. this.measureStyleModel.measureBrokenLine.lineColor = lineColor;
  1181. this.measureStyleModel.measureBrokenLine.lineWidth = lineWidth;
  1182. this.measureStyleModel.measureBrokenLine.lineStyle = lineStyle;
  1183. this.measureStyleModel.measureBrokenLine.linePosition = linePosition;
  1184. break;
  1185. case DrawToolType.MeasureTraceCurve: //曲线长度->轨迹曲线
  1186. this.measureStyleModel.measureTraceCurve.font = font;
  1187. this.measureStyleModel.measureTraceCurve.fontSize = fontSize;
  1188. this.measureStyleModel.measureTraceCurve.textColor = textColor;
  1189. this.measureStyleModel.measureTraceCurve.lineColor = lineColor;
  1190. this.measureStyleModel.measureTraceCurve.lineWidth = lineWidth;
  1191. this.measureStyleModel.measureTraceCurve.lineStyle = lineStyle;
  1192. this.measureStyleModel.measureTraceCurve.linePosition = linePosition;
  1193. break;
  1194. case DrawToolType.MeasureCurveLine: //曲线长度->曲线
  1195. this.measureStyleModel.measureCurveLine.font = font;
  1196. this.measureStyleModel.measureCurveLine.fontSize = fontSize;
  1197. this.measureStyleModel.measureCurveLine.textColor = textColor;
  1198. this.measureStyleModel.measureCurveLine.lineColor = lineColor;
  1199. this.measureStyleModel.measureCurveLine.lineWidth = lineWidth;
  1200. this.measureStyleModel.measureCurveLine.lineStyle = lineStyle;
  1201. this.measureStyleModel.measureCurveLine.linePosition = linePosition;
  1202. break;
  1203. case DrawToolType.MeasurePLine: //点垂线->点垂线
  1204. this.measureStyleModel.measurePLine.font = font;
  1205. this.measureStyleModel.measurePLine.fontSize = fontSize;
  1206. this.measureStyleModel.measurePLine.textColor = textColor;
  1207. this.measureStyleModel.measurePLine.lineColor = lineColor;
  1208. this.measureStyleModel.measurePLine.lineWidth = lineWidth;
  1209. this.measureStyleModel.measurePLine.lineStyle = lineStyle;
  1210. this.measureStyleModel.measurePLine.linePositionL = linePositionL;
  1211. this.measureStyleModel.measurePLine.linePositionP = linePositionP;
  1212. break;
  1213. case DrawToolType.MeasureMulPLine: //点垂线->多点垂线
  1214. this.measureStyleModel.measureMulPLine.font = font;
  1215. this.measureStyleModel.measureMulPLine.fontSize = fontSize;
  1216. this.measureStyleModel.measureMulPLine.textColor = textColor;
  1217. this.measureStyleModel.measureMulPLine.lineColor = lineColor;
  1218. this.measureStyleModel.measureMulPLine.lineWidth = lineWidth;
  1219. this.measureStyleModel.measureMulPLine.lineStyle = lineStyle;
  1220. this.measureStyleModel.measureMulPLine.linePositionL = linePositionL;
  1221. this.measureStyleModel.measureMulPLine.linePositionP = linePositionP;
  1222. break;
  1223. case DrawToolType.MeasureHMulPLine: //点垂线->水平多点垂线
  1224. this.measureStyleModel.measureHMulPLine.font = font;
  1225. this.measureStyleModel.measureHMulPLine.fontSize = fontSize;
  1226. this.measureStyleModel.measureHMulPLine.textColor = textColor;
  1227. this.measureStyleModel.measureHMulPLine.lineColor = lineColor;
  1228. this.measureStyleModel.measureHMulPLine.lineWidth = lineWidth;
  1229. this.measureStyleModel.measureHMulPLine.lineStyle = lineStyle;
  1230. this.measureStyleModel.measureHMulPLine.linePositionL = linePositionL;
  1231. this.measureStyleModel.measureHMulPLine.linePositionP = linePositionP;
  1232. break;
  1233. case DrawToolType.MeasureVMulPLine: //点垂线->垂直多点垂线
  1234. this.measureStyleModel.measureVMulPLine.font = font;
  1235. this.measureStyleModel.measureVMulPLine.fontSize = fontSize;
  1236. this.measureStyleModel.measureVMulPLine.textColor = textColor;
  1237. this.measureStyleModel.measureVMulPLine.lineColor = lineColor;
  1238. this.measureStyleModel.measureVMulPLine.lineWidth = lineWidth;
  1239. this.measureStyleModel.measureVMulPLine.lineStyle = lineStyle;
  1240. this.measureStyleModel.measureVMulPLine.linePositionL = linePositionL;
  1241. this.measureStyleModel.measureVMulPLine.linePositionP = linePositionP;
  1242. break;
  1243. case DrawToolType.MeasurePointHLine: //点垂线->点到水平线距离
  1244. this.measureStyleModel.measurePointHLine.font = font;
  1245. this.measureStyleModel.measurePointHLine.fontSize = fontSize;
  1246. this.measureStyleModel.measurePointHLine.textColor = textColor;
  1247. this.measureStyleModel.measurePointHLine.lineColor = lineColor;
  1248. this.measureStyleModel.measurePointHLine.lineWidth = lineWidth;
  1249. this.measureStyleModel.measurePointHLine.lineStyle = lineStyle;
  1250. this.measureStyleModel.measurePointHLine.linePositionL = linePositionL;
  1251. this.measureStyleModel.measurePointHLine.linePositionP = linePositionP;
  1252. break;
  1253. case DrawToolType.MeasureParallelLine: //平行线测量->平行线
  1254. this.measureStyleModel.measureParallelLine.font = font;
  1255. this.measureStyleModel.measureParallelLine.fontSize = fontSize;
  1256. this.measureStyleModel.measureParallelLine.textColor = textColor;
  1257. this.measureStyleModel.measureParallelLine.lineColor = lineColor;
  1258. this.measureStyleModel.measureParallelLine.lineWidth = lineWidth;
  1259. this.measureStyleModel.measureParallelLine.lineStyle = lineStyle;
  1260. this.measureStyleModel.measureParallelLine.linePositionL = linePositionL;
  1261. this.measureStyleModel.measureParallelLine.linePositionP = linePositionP;
  1262. this.measureStyleModel.measureParallelLine.followLine = this.comboBox5.SelectedIndex == 0 ? true : false;
  1263. break;
  1264. case DrawToolType.MeasureMulParallelLine: //平行线测量->多点平行线
  1265. this.measureStyleModel.measureMulParallelLine.font = font;
  1266. this.measureStyleModel.measureMulParallelLine.fontSize = fontSize;
  1267. this.measureStyleModel.measureMulParallelLine.textColor = textColor;
  1268. this.measureStyleModel.measureMulParallelLine.lineColor = lineColor;
  1269. this.measureStyleModel.measureMulParallelLine.lineWidth = lineWidth;
  1270. this.measureStyleModel.measureMulParallelLine.lineStyle = lineStyle;
  1271. this.measureStyleModel.measureMulParallelLine.linePositionL = linePositionL;
  1272. this.measureStyleModel.measureMulParallelLine.linePositionP = linePositionP;
  1273. break;
  1274. case DrawToolType.MeasureVMulParallelLine: //平行线测量->垂直多点平行线
  1275. this.measureStyleModel.measureVMulParallelLine.font = font;
  1276. this.measureStyleModel.measureVMulParallelLine.fontSize = fontSize;
  1277. this.measureStyleModel.measureVMulParallelLine.textColor = textColor;
  1278. this.measureStyleModel.measureVMulParallelLine.lineColor = lineColor;
  1279. this.measureStyleModel.measureVMulParallelLine.lineWidth = lineWidth;
  1280. this.measureStyleModel.measureVMulParallelLine.lineStyle = lineStyle;
  1281. this.measureStyleModel.measureVMulParallelLine.linePositionL = linePositionL;
  1282. this.measureStyleModel.measureVMulParallelLine.linePositionP = linePositionP;
  1283. break;
  1284. case DrawToolType.MeasureHMulParallelLine: //平行线测量->水平多点平行线
  1285. this.measureStyleModel.measureHMulParallelLine.font = font;
  1286. this.measureStyleModel.measureHMulParallelLine.fontSize = fontSize;
  1287. this.measureStyleModel.measureHMulParallelLine.textColor = textColor;
  1288. this.measureStyleModel.measureHMulParallelLine.lineColor = lineColor;
  1289. this.measureStyleModel.measureHMulParallelLine.lineWidth = lineWidth;
  1290. this.measureStyleModel.measureHMulParallelLine.lineStyle = lineStyle;
  1291. this.measureStyleModel.measureHMulParallelLine.linePositionL = linePositionL;
  1292. this.measureStyleModel.measureHMulParallelLine.linePositionP = linePositionP;
  1293. break;
  1294. case DrawToolType.MeasureClosedCurve: //多边形测量->闭合曲线
  1295. this.measureStyleModel.measureClosedCurve.font = font;
  1296. this.measureStyleModel.measureClosedCurve.fontSize = fontSize;
  1297. this.measureStyleModel.measureClosedCurve.textColor = textColor;
  1298. this.measureStyleModel.measureClosedCurve.lineColor = lineColor;
  1299. this.measureStyleModel.measureClosedCurve.lineWidth = lineWidth;
  1300. this.measureStyleModel.measureClosedCurve.lineStyle = lineStyle;
  1301. break;
  1302. case DrawToolType.MeasurePolygon: //多边形测量->多边形
  1303. this.measureStyleModel.measurePolygon.font = font;
  1304. this.measureStyleModel.measurePolygon.fontSize = fontSize;
  1305. this.measureStyleModel.measurePolygon.textColor = textColor;
  1306. this.measureStyleModel.measurePolygon.lineColor = lineColor;
  1307. this.measureStyleModel.measurePolygon.lineWidth = lineWidth;
  1308. this.measureStyleModel.measurePolygon.lineStyle = lineStyle;
  1309. break;
  1310. case DrawToolType.MeasureRectangle: //多边形测量->矩形
  1311. this.measureStyleModel.measureRectangle.font = font;
  1312. this.measureStyleModel.measureRectangle.fontSize = fontSize;
  1313. this.measureStyleModel.measureRectangle.textColor = textColor;
  1314. this.measureStyleModel.measureRectangle.lineColor = lineColor;
  1315. this.measureStyleModel.measureRectangle.lineWidth = lineWidth;
  1316. this.measureStyleModel.measureRectangle.lineStyle = lineStyle;
  1317. break;
  1318. case DrawToolType.MeasureRandRectangle: //多边形测量->任意矩形
  1319. this.measureStyleModel.measureRandRectangle.font = font;
  1320. this.measureStyleModel.measureRandRectangle.fontSize = fontSize;
  1321. this.measureStyleModel.measureRandRectangle.textColor = textColor;
  1322. this.measureStyleModel.measureRandRectangle.lineColor = lineColor;
  1323. this.measureStyleModel.measureRandRectangle.lineWidth = lineWidth;
  1324. this.measureStyleModel.measureRandRectangle.lineStyle = lineStyle;
  1325. break;
  1326. case DrawToolType.MeasureSquare: //多边形测量->正方形
  1327. this.measureStyleModel.measureSquare.font = font;
  1328. this.measureStyleModel.measureSquare.fontSize = fontSize;
  1329. this.measureStyleModel.measureSquare.textColor = textColor;
  1330. this.measureStyleModel.measureSquare.lineColor = lineColor;
  1331. this.measureStyleModel.measureSquare.lineWidth = lineWidth;
  1332. this.measureStyleModel.measureSquare.lineStyle = lineStyle;
  1333. break;
  1334. case DrawToolType.MeasureRandSquare: //多边形测量->任意正方形
  1335. this.measureStyleModel.measureRandSquare.font = font;
  1336. this.measureStyleModel.measureRandSquare.fontSize = fontSize;
  1337. this.measureStyleModel.measureRandSquare.textColor = textColor;
  1338. this.measureStyleModel.measureRandSquare.lineColor = lineColor;
  1339. this.measureStyleModel.measureRandSquare.lineWidth = lineWidth;
  1340. this.measureStyleModel.measureRandSquare.lineStyle = lineStyle;
  1341. break;
  1342. case DrawToolType.MeasureTracePolygon: //多边形测量->轨迹多边形
  1343. this.measureStyleModel.measureTracePolygon.font = font;
  1344. this.measureStyleModel.measureTracePolygon.fontSize = fontSize;
  1345. this.measureStyleModel.measureTracePolygon.textColor = textColor;
  1346. this.measureStyleModel.measureTracePolygon.lineColor = lineColor;
  1347. this.measureStyleModel.measureTracePolygon.lineWidth = lineWidth;
  1348. this.measureStyleModel.measureTracePolygon.lineStyle = lineStyle;
  1349. break;
  1350. case DrawToolType.MeasureCircle: //圆形测量->三点圆
  1351. this.measureStyleModel.measureCircle.font = font;
  1352. this.measureStyleModel.measureCircle.fontSize = fontSize;
  1353. this.measureStyleModel.measureCircle.textColor = textColor;
  1354. this.measureStyleModel.measureCircle.lineColor = lineColor;
  1355. this.measureStyleModel.measureCircle.lineWidth = lineWidth;
  1356. this.measureStyleModel.measureCircle.lineStyle = lineStyle;
  1357. break;
  1358. case DrawToolType.MeasureInnerCircle: //圆形测量->向内画圆
  1359. this.measureStyleModel.measureInnerCircle.font = font;
  1360. this.measureStyleModel.measureInnerCircle.fontSize = fontSize;
  1361. this.measureStyleModel.measureInnerCircle.textColor = textColor;
  1362. this.measureStyleModel.measureInnerCircle.lineColor = lineColor;
  1363. this.measureStyleModel.measureInnerCircle.lineWidth = lineWidth;
  1364. this.measureStyleModel.measureInnerCircle.lineStyle = lineStyle;
  1365. break;
  1366. case DrawToolType.MeasureOuterCircle: //圆形测量->向外画圆
  1367. this.measureStyleModel.measureOuterCircle.font = font;
  1368. this.measureStyleModel.measureOuterCircle.fontSize = fontSize;
  1369. this.measureStyleModel.measureOuterCircle.textColor = textColor;
  1370. this.measureStyleModel.measureOuterCircle.lineColor = lineColor;
  1371. this.measureStyleModel.measureOuterCircle.lineWidth = lineWidth;
  1372. this.measureStyleModel.measureOuterCircle.lineStyle = lineStyle;
  1373. break;
  1374. case DrawToolType.MeasureDiameterCircle: //圆形测量->直径画圆
  1375. this.measureStyleModel.measureDiameterCircle.font = font;
  1376. this.measureStyleModel.measureDiameterCircle.fontSize = fontSize;
  1377. this.measureStyleModel.measureDiameterCircle.textColor = textColor;
  1378. this.measureStyleModel.measureDiameterCircle.lineColor = lineColor;
  1379. this.measureStyleModel.measureDiameterCircle.lineWidth = lineWidth;
  1380. this.measureStyleModel.measureDiameterCircle.lineStyle = lineStyle;
  1381. break;
  1382. case DrawToolType.MeasurePointEdgeSize: //圆形测量->点到圆距离
  1383. this.measureStyleModel.measurePointEdgeSize.font = font;
  1384. this.measureStyleModel.measurePointEdgeSize.fontSize = fontSize;
  1385. this.measureStyleModel.measurePointEdgeSize.textColor = textColor;
  1386. this.measureStyleModel.measurePointEdgeSize.lineColor = lineColor;
  1387. this.measureStyleModel.measurePointEdgeSize.lineWidth = lineWidth;
  1388. this.measureStyleModel.measurePointEdgeSize.lineStyle = lineStyle;
  1389. break;
  1390. case DrawToolType.MeasurePointCenterSize: //圆形测量->点到圆心距离
  1391. this.measureStyleModel.measurePointCenterSize.font = font;
  1392. this.measureStyleModel.measurePointCenterSize.fontSize = fontSize;
  1393. this.measureStyleModel.measurePointCenterSize.textColor = textColor;
  1394. this.measureStyleModel.measurePointCenterSize.lineColor = lineColor;
  1395. this.measureStyleModel.measurePointCenterSize.lineWidth = lineWidth;
  1396. this.measureStyleModel.measurePointCenterSize.lineStyle = lineStyle;
  1397. break;
  1398. case DrawToolType.MeasurePointArcSize: //圆形测量->点到圆弧距离
  1399. this.measureStyleModel.measurePointArcSize.font = font;
  1400. this.measureStyleModel.measurePointArcSize.fontSize = fontSize;
  1401. this.measureStyleModel.measurePointArcSize.textColor = textColor;
  1402. this.measureStyleModel.measurePointArcSize.lineColor = lineColor;
  1403. this.measureStyleModel.measurePointArcSize.lineWidth = lineWidth;
  1404. this.measureStyleModel.measurePointArcSize.lineStyle = lineStyle;
  1405. break;
  1406. case DrawToolType.MeasureThreePointAngle: //角度测量->三点角度
  1407. this.measureStyleModel.measureThreePointAngle.font = font;
  1408. this.measureStyleModel.measureThreePointAngle.fontSize = fontSize;
  1409. this.measureStyleModel.measureThreePointAngle.textColor = textColor;
  1410. this.measureStyleModel.measureThreePointAngle.lineColor = lineColor;
  1411. this.measureStyleModel.measureThreePointAngle.lineWidth = lineWidth;
  1412. this.measureStyleModel.measureThreePointAngle.lineStyle = lineStyle;
  1413. this.measureStyleModel.measureThreePointAngle.isAngle = isAngle;
  1414. break;
  1415. case DrawToolType.MeasureFourPointAngle: //角度测量->四点角度
  1416. this.measureStyleModel.measureFourPointAngle.font = font;
  1417. this.measureStyleModel.measureFourPointAngle.fontSize = fontSize;
  1418. this.measureStyleModel.measureFourPointAngle.textColor = textColor;
  1419. this.measureStyleModel.measureFourPointAngle.lineColor = lineColor;
  1420. this.measureStyleModel.measureFourPointAngle.lineWidth = lineWidth;
  1421. this.measureStyleModel.measureFourPointAngle.lineStyle = lineStyle;
  1422. this.measureStyleModel.measureFourPointAngle.isAngle = isAngle;
  1423. break;
  1424. case DrawToolType.MeasureThreePointArc: //角度测量->三点弧
  1425. this.measureStyleModel.measureThreePointArc.font = font;
  1426. this.measureStyleModel.measureThreePointArc.fontSize = fontSize;
  1427. this.measureStyleModel.measureThreePointArc.textColor = textColor;
  1428. this.measureStyleModel.measureThreePointArc.lineColor = lineColor;
  1429. this.measureStyleModel.measureThreePointArc.lineWidth = lineWidth;
  1430. this.measureStyleModel.measureThreePointArc.lineStyle = lineStyle;
  1431. this.measureStyleModel.measureThreePointArc.isAngle = isAngle;
  1432. break;
  1433. case DrawToolType.MeasureCenterCenterSize: //对准度测量->圆心到圆心距离
  1434. this.measureStyleModel.measureCenterCenterSize.font = font;
  1435. this.measureStyleModel.measureCenterCenterSize.fontSize = fontSize;
  1436. this.measureStyleModel.measureCenterCenterSize.textColor = textColor;
  1437. this.measureStyleModel.measureCenterCenterSize.lineColor = lineColor;
  1438. this.measureStyleModel.measureCenterCenterSize.lineWidth = lineWidth;
  1439. this.measureStyleModel.measureCenterCenterSize.lineStyle = lineStyle;
  1440. this.measureStyleModel.measureCenterCenterSize.linePosition = linePosition;
  1441. break;
  1442. case DrawToolType.MeasureTwoLineVLDistance: //对准度测量->两线中垂线距离
  1443. this.measureStyleModel.measureTwoLineVLDistance.font = font;
  1444. this.measureStyleModel.measureTwoLineVLDistance.fontSize = fontSize;
  1445. this.measureStyleModel.measureTwoLineVLDistance.textColor = textColor;
  1446. this.measureStyleModel.measureTwoLineVLDistance.lineColor = lineColor;
  1447. this.measureStyleModel.measureTwoLineVLDistance.lineWidth = lineWidth;
  1448. this.measureStyleModel.measureTwoLineVLDistance.lineStyle = lineStyle;
  1449. this.measureStyleModel.measureTwoLineVLDistance.linePosition = linePosition;
  1450. break;
  1451. }
  1452. }
  1453. /// <summary>
  1454. /// 应用
  1455. /// </summary>
  1456. /// <param name="sender"></param>
  1457. /// <param name="e"></param>
  1458. private void button1_Click(object sender, EventArgs e)
  1459. {
  1460. button2_Click();
  1461. //修改缓存中的样式数据
  1462. Startup.instance.measureStyleModel = this.measureStyleModel;
  1463. //修改主配置文件中的值
  1464. configModel.MeasurementStyle = "Default.xml";
  1465. //修改主配置文件的xml
  1466. string configModelXml = XmlSerializeHelper.XmlSerialize<ConfigModel>(this.configModel);
  1467. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Config.xml";
  1468. FileOperationHelper.WriteStringToFile(configModelXml, filePath, FileMode.Create);
  1469. MessageBox.Show(PdnResources.GetString("Menu.Applicationsuccessfully.Text"));
  1470. ((MeasureDrawObject)(this.drawObject)).mouseUpAttribute = true;
  1471. this.appWorkspace.ActiveDocumentWorkspace.Refresh();
  1472. this.appWorkspace.RefreshListView();
  1473. this.Close();
  1474. }
  1475. /// <summary>
  1476. /// 关闭
  1477. /// </summary>
  1478. /// <param name="sender"></param>
  1479. /// <param name="e"></param>
  1480. private void button3_Click(object sender, EventArgs e)
  1481. {
  1482. this.Close();
  1483. }
  1484. }
  1485. }