1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330 |
- using Resources;
- using SmartCoalApplication.Annotation.Enum;
- using SmartCoalApplication.Annotation.relationModel;
- using SmartCoalApplication.Base;
- using SmartCoalApplication.Base.CommTool;
- using SmartCoalApplication.Base.SettingModel;
- using SmartCoalApplication.Core;
- using SmartCoalApplication.PluginAssemblys;
- using SmartCoalApplication.Resources;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace SmartCoalApplication.Measure
- {
- internal class MeasureSettingDialog : PdnBaseForm
- {
- /// <summary>
- /// 测量一二级关系
- /// </summary>
- private static List<MeasureRelationModel> list;
- /// <summary>
- /// 当前选中的二级标注
- /// </summary>
- private DrawToolType drawToolType;
- /// <summary>
- /// 测量的样式
- /// </summary>
- private MeasureStyleModel measureStyleModel = Program.instance.measureStyleModel;
- /// <summary>
- /// 主配置文件的model
- /// </summary>
- private ConfigModel configModel = Program.instance.configModel;
- /// <summary>
- /// 操作区控件
- /// </summary>
- private GroupBox groupBox1;
- private Label label1;
- private ComboBox comboBox1;
- private Button button4;
- private Button button3;
- private Button button2;
- private Panel panel1;
- private ListBox listBox1;
- private GroupBox groupBox3;
- private GroupBox groupBox2;
- private GroupBox groupBox4;
- private ConfigModel config = Program.instance.configModel;
- /// <summary>
- /// 设置区控件
- /// </summary>
- private System.Windows.Forms.Label label11;
- private System.Windows.Forms.ComboBox comboBox11;
- private System.Windows.Forms.Label label21;
- private System.Windows.Forms.Label label31;
- private System.Windows.Forms.Panel textPanel;
- private System.Windows.Forms.Panel linePanel;
- private System.Windows.Forms.Label label41;
- private System.Windows.Forms.Label label51;
- private System.Windows.Forms.Label label61;
- private System.Windows.Forms.Label label71;
- /// <summary>
- /// 测量样式
- /// </summary>
- private NumericUpDown numericUpDown21;
- private ComboBox comboBox21;
- private NumericUpDown numericUpDown11;
- private NumericUpDown numericUpDown71;
- private Button button5;
- /// <summary>
- /// 字体列表
- /// </summary>
- ArrayList fontsItems = new ArrayList();
- /// <summary>
- /// 另存为弹出框显示
- /// </summary>
- private CreateNameDialog dialog;
- /// <summary>
- /// 操作样式下拉数据
- /// </summary>
- private List<string> files = new List<string>();
- /// <summary>
- /// 另存为文件名
- /// </summary>
- private string newName;
- /// <summary>
- /// 选中的测量类型
- /// </summary>
- private int selectId;
- ColorsForm colorsForm;
- ColorsForm colorsForm1;
- private Panel panel2;
- private ComboBox comboBox2;
- private Label label2;
- private Panel panel3;
- private ComboBox comboBox4;
- private Label label4;
- private ComboBox comboBox3;
- private ComboBox comboBox91;
- private Label label3;
- private Button button6;
- private NumericUpDown numericUpDown1;
- private Label label5;
- private ComboBox comboBox5;
- private Label label6;
- private int initflag = 0;
- private AppWorkspace appWorkspace;
- private System.Windows.Forms.Label label91;
- public MeasureSettingDialog(AppWorkspace appWorkspace)
- {
- if (list == null)
- {
- list = InvariantData.GetMeasureRelations();
- }
- this.appWorkspace = appWorkspace;
- InitializeComponent();
- InitializeLanguageText();
- InitializeComponent2();
- this.Icon = PdnInfo.AppIcon;
- //绑定线样式数据
- this.comboBox21.Items.AddRange(InvariantData.dashStyles);
- InitializeData();
- }
- private void InitializeLanguageText()
- {
- this.label1.Text = PdnResources.GetString("Menu.Currentoperationstyle.text") + ":";
- this.button4.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button3.Text = PdnResources.GetString("Menu.File.SaveAs.Text");
- this.button2.Text = PdnResources.GetString("Menu.File.Save.Text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Setting.Text");
- this.groupBox4.Text = PdnResources.GetString("Menu.Setting.Text");
- this.comboBox3.Items.AddRange(new object[] {
- PdnResources.GetString("Menu.Upperleft.text"),
- PdnResources.GetString("Menu.Uppermiddle.Text"),
- PdnResources.GetString("Menu.Upperright.text"),
- PdnResources.GetString("Menu.Lowerleft.text"),
- PdnResources.GetString("Menu.Themiddleandlower.Text"),
- PdnResources.GetString("Menu.Lowerright.text")});
- this.comboBox91.Items.AddRange(new object[] {
- PdnResources.GetString("NewDegree"),
- PdnResources.GetString("NewSecretPlace")});
- this.comboBox4.Items.AddRange(new object[] {
- PdnResources.GetString("Menu.Upperleft.text"),
- PdnResources.GetString("Menu.Uppermiddle.Text"),
- PdnResources.GetString("Menu.Upperright.text"),
- PdnResources.GetString("Menu.Lowerleft.text"),
- PdnResources.GetString("Menu.Themiddleandlower.Text"),
- PdnResources.GetString("Menu.Lowerright.text")});
- this.label4.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textposition.text") + "(" + PdnResources.GetString("Menu.Generalanalysis.Integrator.point.text") + "):";
- this.label3.Text = PdnResources.GetString("Menu.Textpositionli.Text") + ":";
- this.label2.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textposition.text") + ":";
- this.label5.Text = PdnResources.GetString("NewVerticalLength") + ":";
- this.label61.Text = PdnResources.GetString("Menu.Linestyle.Text") + ":";
- this.label71.Text = PdnResources.GetString("NewMarkerPointSize") + ":";
- this.label51.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linewidth.text") + ":";
- this.label41.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linecolor.text") + ":";
- this.label31.Text = PdnResources.GetString("Menu.Textcolor.text") + ":";
- this.label21.Text = PdnResources.GetString("Menu.Set.Rulersettings.Fontsize.text") + ":";
- this.label11.Text = PdnResources.GetString("Menu.Textfont.text") + ":";
- this.button6.Text = PdnResources.GetString("Menu.File.SaveAll.Text");
- this.groupBox3.Text = PdnResources.GetString("Menu.Type.text");
- this.Text = PdnResources.GetString("Menu.Setting.MeasureSetting.Text");
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- }
- private void InitializeComponent()
- {
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.label1 = new System.Windows.Forms.Label();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.panel1 = new System.Windows.Forms.Panel();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.comboBox5 = new System.Windows.Forms.ComboBox();
- this.label6 = new System.Windows.Forms.Label();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label5 = new System.Windows.Forms.Label();
- this.panel3 = new System.Windows.Forms.Panel();
- this.comboBox4 = new System.Windows.Forms.ComboBox();
- this.label4 = new System.Windows.Forms.Label();
- this.comboBox3 = new System.Windows.Forms.ComboBox();
- this.label3 = new System.Windows.Forms.Label();
- this.panel2 = new System.Windows.Forms.Panel();
- this.comboBox2 = new System.Windows.Forms.ComboBox();
- this.label2 = new System.Windows.Forms.Label();
- this.numericUpDown11 = new System.Windows.Forms.NumericUpDown();
- this.comboBox21 = new System.Windows.Forms.ComboBox();
- this.numericUpDown21 = new System.Windows.Forms.NumericUpDown();
- this.label61 = new System.Windows.Forms.Label();
- this.label51 = new System.Windows.Forms.Label();
- this.linePanel = new System.Windows.Forms.Panel();
- this.label41 = new System.Windows.Forms.Label();
- this.textPanel = new System.Windows.Forms.Panel();
- this.label31 = new System.Windows.Forms.Label();
- this.label91 = new System.Windows.Forms.Label();
- this.comboBox91 = new System.Windows.Forms.ComboBox();
- this.label21 = new System.Windows.Forms.Label();
- this.comboBox11 = new System.Windows.Forms.ComboBox();
- this.label11 = new System.Windows.Forms.Label();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.label71 = new System.Windows.Forms.Label();
- this.numericUpDown71 = new System.Windows.Forms.NumericUpDown();
- this.button6 = new System.Windows.Forms.Button();
- this.listBox1 = new System.Windows.Forms.ListBox();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.button5 = new System.Windows.Forms.Button();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- this.panel3.SuspendLayout();
- this.panel2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown21)).BeginInit();
- this.groupBox4.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown71)).BeginInit();
- this.groupBox3.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.comboBox1);
- this.groupBox1.Controls.Add(this.button4);
- this.groupBox1.Controls.Add(this.button3);
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Location = new System.Drawing.Point(137, 12);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(716, 58);
- this.groupBox1.TabIndex = 3;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "操作";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(172, 25);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(0, 12);
- this.label1.TabIndex = 5;
- //
- // comboBox1
- //
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Location = new System.Drawing.Point(351, 21);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(116, 20);
- this.comboBox1.TabIndex = 4;
- this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
- this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(473, 20);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(75, 23);
- this.button4.TabIndex = 3;
- this.button4.Text = "删除";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.Button4_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(554, 20);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(75, 23);
- this.button3.TabIndex = 2;
- this.button3.Text = "另存为";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.Button3_Click);
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(635, 20);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 1;
- this.button2.Text = "保存";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.Button2_Click);
- //
- // panel1
- //
- this.panel1.Location = new System.Drawing.Point(137, 76);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(633, 36);
- this.panel1.TabIndex = 8;
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.comboBox5);
- this.groupBox2.Controls.Add(this.label6);
- this.groupBox2.Controls.Add(this.numericUpDown1);
- this.groupBox2.Controls.Add(this.label5);
- this.groupBox2.Controls.Add(this.panel3);
- this.groupBox2.Controls.Add(this.panel2);
- this.groupBox2.Controls.Add(this.numericUpDown11);
- this.groupBox2.Controls.Add(this.comboBox21);
- this.groupBox2.Controls.Add(this.numericUpDown21);
- this.groupBox2.Controls.Add(this.label61);
- this.groupBox2.Controls.Add(this.label51);
- this.groupBox2.Controls.Add(this.linePanel);
- this.groupBox2.Controls.Add(this.label41);
- this.groupBox2.Controls.Add(this.textPanel);
- this.groupBox2.Controls.Add(this.label31);
- this.groupBox2.Controls.Add(this.label91);
- this.groupBox2.Controls.Add(this.comboBox91);
- this.groupBox2.Controls.Add(this.label21);
- this.groupBox2.Controls.Add(this.comboBox11);
- this.groupBox2.Controls.Add(this.label11);
- this.groupBox2.Location = new System.Drawing.Point(137, 118);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(716, 235);
- this.groupBox2.TabIndex = 6;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "设置";
- //
- // comboBox5
- //
- this.comboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox5.FormattingEnabled = true;
- this.comboBox5.Items.AddRange(new object[] {
- PdnResources.GetString("NewFollowingTheLine"),
- PdnResources.GetString("NewLevel")});
- this.comboBox5.Location = new System.Drawing.Point(342, 46);
- this.comboBox5.Name = "comboBox5";
- this.comboBox5.Size = new System.Drawing.Size(122, 20);
- this.comboBox5.TabIndex = 20;
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(265, 50);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(65, 12);
- this.label6.TabIndex = 19;
- this.label6.Text = "文字方向:";
- //
- // numericUpDown1
- //
- this.numericUpDown1.Location = new System.Drawing.Point(342, 19);
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(152, 21);
- this.numericUpDown1.TabIndex = 18;
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(265, 23);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(65, 12);
- this.label5.TabIndex = 17;
- this.label5.Text = "垂线长度:";
- //
- // panel3
- //
- this.panel3.Controls.Add(this.comboBox4);
- this.panel3.Controls.Add(this.label4);
- this.panel3.Controls.Add(this.comboBox3);
- this.panel3.Controls.Add(this.label3);
- this.panel3.Location = new System.Drawing.Point(9, 175);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(236, 57);
- this.panel3.TabIndex = 16;
- //
- // comboBox4
- //
- this.comboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox4.FormattingEnabled = true;
- this.comboBox4.Location = new System.Drawing.Point(112, 30);
- this.comboBox4.Name = "comboBox4";
- this.comboBox4.Size = new System.Drawing.Size(122, 20);
- this.comboBox4.TabIndex = 17;
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(5, 34);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(89, 12);
- this.label4.TabIndex = 16;
- this.label4.Text = "文字位置(点):";
- //
- // comboBox3
- //
- this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox3.FormattingEnabled = true;
- this.comboBox3.Location = new System.Drawing.Point(112, 4);
- this.comboBox3.Name = "comboBox3";
- this.comboBox3.Size = new System.Drawing.Size(122, 20);
- this.comboBox3.TabIndex = 15;
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(5, 7);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(89, 12);
- this.label3.TabIndex = 14;
- this.label3.Text = "文字位置(线):";
- //
- // panel2
- //
- this.panel2.Controls.Add(this.comboBox2);
- this.panel2.Controls.Add(this.label2);
- this.panel2.Location = new System.Drawing.Point(9, 175);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(236, 57);
- this.panel2.TabIndex = 15;
- //
- // comboBox2
- //
- this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox2.FormattingEnabled = true;
- this.comboBox2.Location = new System.Drawing.Point(82, 3);
- this.comboBox2.Name = "comboBox2";
- this.comboBox2.Size = new System.Drawing.Size(152, 20);
- this.comboBox2.TabIndex = 15;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(5, 7);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(0, 12);
- this.label2.TabIndex = 14;
- //
- // numericUpDown11
- //
- this.numericUpDown11.Location = new System.Drawing.Point(91, 125);
- this.numericUpDown11.Name = "numericUpDown11";
- this.numericUpDown11.Size = new System.Drawing.Size(152, 21);
- this.numericUpDown11.TabIndex = 14;
- //
- // comboBox21
- //
- this.comboBox21.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox21.FormattingEnabled = true;
- this.comboBox21.Location = new System.Drawing.Point(91, 151);
- this.comboBox21.Name = "comboBox21";
- this.comboBox21.Size = new System.Drawing.Size(152, 20);
- this.comboBox21.TabIndex = 13;
- //
- // numericUpDown21
- //
- this.numericUpDown21.Location = new System.Drawing.Point(91, 46);
- this.numericUpDown21.Name = "numericUpDown21";
- this.numericUpDown21.Size = new System.Drawing.Size(152, 21);
- this.numericUpDown21.TabIndex = 12;
- //
- // label61
- //
- this.label61.AutoSize = true;
- this.label61.Location = new System.Drawing.Point(13, 155);
- this.label61.Name = "label61";
- this.label61.Size = new System.Drawing.Size(65, 12);
- this.label61.TabIndex = 9;
- this.label61.Text = "线条样式:";
- //
- // label51
- //
- this.label51.AutoSize = true;
- this.label51.Location = new System.Drawing.Point(13, 128);
- this.label51.Name = "label51";
- this.label51.Size = new System.Drawing.Size(65, 12);
- this.label51.TabIndex = 8;
- this.label51.Text = "线条宽度:";
- //
- // linePanel
- //
- this.linePanel.BackColor = System.Drawing.SystemColors.Window;
- this.linePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.linePanel.Location = new System.Drawing.Point(91, 99);
- this.linePanel.Name = "linePanel";
- this.linePanel.Size = new System.Drawing.Size(152, 20);
- this.linePanel.TabIndex = 7;
- this.linePanel.Click += new System.EventHandler(this.lineColorPanel_Click);
- //
- // label41
- //
- this.label41.AutoSize = true;
- this.label41.Location = new System.Drawing.Point(13, 99);
- this.label41.Name = "label41";
- this.label41.Size = new System.Drawing.Size(65, 12);
- this.label41.TabIndex = 6;
- this.label41.Text = "线条颜色:";
- //
- // textPanel
- //
- this.textPanel.BackColor = System.Drawing.SystemColors.Window;
- this.textPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.textPanel.Location = new System.Drawing.Point(91, 73);
- this.textPanel.Name = "textPanel";
- this.textPanel.Size = new System.Drawing.Size(152, 20);
- this.textPanel.TabIndex = 5;
- this.textPanel.Click += new System.EventHandler(this.textColorPanel_Click);
- //
- // label31
- //
- this.label31.AutoSize = true;
- this.label31.Location = new System.Drawing.Point(13, 76);
- this.label31.Name = "label31";
- this.label31.Size = new System.Drawing.Size(65, 12);
- this.label31.TabIndex = 4;
- this.label31.Text = "文字颜色:";
- //
- // label91
- //
- this.label91.AutoSize = true;
- this.label91.Location = new System.Drawing.Point(14, 182);
- this.label91.Name = "label91";
- this.label91.Size = new System.Drawing.Size(65, 12);
- this.label91.TabIndex = 14;
- this.label91.Text = "角度单位:";
- //
- // comboBox91
- //
- this.comboBox91.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox91.FormattingEnabled = true;
- this.comboBox91.Location = new System.Drawing.Point(91, 179);
- this.comboBox91.Name = "comboBox91";
- this.comboBox91.Size = new System.Drawing.Size(152, 20);
- this.comboBox91.TabIndex = 15;
- //
- // label21
- //
- this.label21.AutoSize = true;
- this.label21.Location = new System.Drawing.Point(13, 50);
- this.label21.Name = "label21";
- this.label21.Size = new System.Drawing.Size(65, 12);
- this.label21.TabIndex = 2;
- this.label21.Text = "文字字号:";
- //
- // comboBox11
- //
- this.comboBox11.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox11.FormattingEnabled = true;
- this.comboBox11.Location = new System.Drawing.Point(91, 20);
- this.comboBox11.Name = "comboBox11";
- this.comboBox11.Size = new System.Drawing.Size(152, 20);
- this.comboBox11.TabIndex = 1;
- //
- // label11
- //
- this.label11.AutoSize = true;
- this.label11.Location = new System.Drawing.Point(13, 23);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(65, 12);
- this.label11.TabIndex = 0;
- this.label11.Text = "文字字体:";
- //
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.label71);
- this.groupBox4.Controls.Add(this.numericUpDown71);
- this.groupBox4.Location = new System.Drawing.Point(137, 76);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(716, 277);
- this.groupBox4.TabIndex = 6;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "设置";
- this.groupBox4.Visible = false;
- //
- // label71
- //
- this.label71.AutoSize = true;
- this.label71.Location = new System.Drawing.Point(13, 23);
- this.label71.Name = "label71";
- this.label71.Size = new System.Drawing.Size(77, 12);
- this.label71.TabIndex = 0;
- this.label71.Text = "标记点大小:";
- //
- // numericUpDown71
- //
- this.numericUpDown71.Location = new System.Drawing.Point(91, 23);
- this.numericUpDown71.Maximum = new decimal(new int[] {
- 100000,
- 0,
- 0,
- 0});
- this.numericUpDown71.Name = "numericUpDown71";
- this.numericUpDown71.Size = new System.Drawing.Size(152, 21);
- this.numericUpDown71.TabIndex = 14;
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(778, 76);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(75, 23);
- this.button6.TabIndex = 17;
- this.button6.Text = "保存全部";
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // listBox1
- //
- this.listBox1.FormattingEnabled = true;
- this.listBox1.ItemHeight = 12;
- this.listBox1.Location = new System.Drawing.Point(6, 20);
- this.listBox1.Name = "listBox1";
- this.listBox1.Size = new System.Drawing.Size(103, 316);
- this.listBox1.TabIndex = 0;
- this.listBox1.SelectedValueChanged += new System.EventHandler(this.listBox1_SelectedValueChanged);
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.listBox1);
- this.groupBox3.Location = new System.Drawing.Point(12, 12);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(115, 341);
- this.groupBox3.TabIndex = 9;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "类型";
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(0, 0);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(75, 23);
- this.button5.TabIndex = 0;
- //
- // MeasureSettingDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(865, 358);
- this.Controls.Add(this.button6);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.panel1);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.MinimizeBox = false;
- this.Name = "MeasureSettingDialog";
- this.Text = "测量设置";
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.panel1, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.button6, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- this.panel3.ResumeLayout(false);
- this.panel3.PerformLayout();
- this.panel2.ResumeLayout(false);
- this.panel2.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown21)).EndInit();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown71)).EndInit();
- this.groupBox3.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- #region InitializeComponent2
- /// <summary>
- /// 初始化组件
- /// </summary>
- private void InitializeComponent2()
- {
- this.colorsForm = new ColorsForm();
- this.colorsForm.StartPosition = FormStartPosition.CenterScreen;
- this.colorsForm.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- this.colorsForm1 = new ColorsForm();
- this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
- this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- }
- #endregion
- /// <summary>
- /// 初始化数据
- /// </summary>
- private void InitializeData()
- {
- this.listBox1.Items.Clear();
- //绑定左侧listbox数据
- foreach (MeasureRelationModel model in list)
- {
- if (model.id > 0)
- this.listBox1.Items.Add(model.name);
- }
- this.listBox1.SelectedIndex = 0;
- this.fontsItems.Clear();
- //绑定字体数据
- System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
- foreach (FontFamily fontFamily in fonts.Families)
- {
- fontsItems.Add(fontFamily.Name);
- }
- this.comboBox11.DataSource = fontsItems;
- //绑定样式默认数据
- this.comboBox11.Text = this.measureStyleModel.measureLine.font;
- this.numericUpDown21.Value = this.measureStyleModel.measureLine.fontSize;
- this.textPanel.BackColor = Color.FromArgb(this.measureStyleModel.measureLine.textColor);
- this.linePanel.BackColor = Color.FromArgb(this.measureStyleModel.measureLine.lineColor);
- this.numericUpDown11.Value = this.measureStyleModel.measureLine.lineWidth;
- this.comboBox21.SelectedIndex = this.measureStyleModel.measureLine.lineStyle;
- this.comboBox2.SelectedIndex = this.measureStyleModel.measureLine.linePosition;
- this.numericUpDown1.Value = this.measureStyleModel.measureLine.vLineLength;
- this.numericUpDown71.Value = this.config.MarkpointWidth;
- //绑定样式下拉 todo
- if (initflag++ == 0)
- {
- InitializeStyleName();
- }
- }
- /// <summary>
- /// 左侧listbox选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listBox1_SelectedValueChanged(object sender, EventArgs e)
- {
- //首先更新右侧分类部分
- UpdateRightCatalog();
- //更新右侧设置界面
- UpdateRightSettingUI();
- //刷新右侧预览
- UpdateRightPreview();
- }
- /// <summary>
- /// 更新右侧分类
- /// </summary>
- private void UpdateRightCatalog()
- {
- this.panel1.Controls.Clear();
- MeasureRelationModel model = list[this.listBox1.SelectedIndex + 1];
- this.selectId = model.id;
- if (this.selectId == 10)
- {
- groupBox2.Visible = false;
- groupBox4.Visible = true;
- panel1.Visible = false;
- button6.Visible = false;
- comboBox1.Visible = false;
- button4.Visible = false;
- button3.Visible = false;
- label1.Visible = false;
- }
- else
- {
- groupBox2.Visible = true;
- groupBox4.Visible = false;
- panel1.Visible = true;
- button6.Visible = true;
- comboBox1.Visible = true;
- button4.Visible = true;
- button3.Visible = true;
- label1.Visible = true;
- }
- int postion = 0;
- foreach (MeasureRelationModel.ChildLabel child in model.childLabel)
- {
- if ((int)child.drawToolType > 0)
- {
- Button button = new Button();
- button.Size = new Size(75, 23);
- button.Location = new Point(postion * 75 + 5, 0);
- button.Text = child.name;
- button.Tag = child;
- button.Click += new EventHandler(ChildButton_Click);
- this.panel1.Controls.Add(button);
- if (postion == 0)
- {
- this.drawToolType = child.drawToolType;
- button.Focus();
- }
- postion++;
- }
- }
- }
- /// <summary>
- /// 二级分类按钮点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ChildButton_Click(object sender, EventArgs e)
- {
- Button button = (Button)sender;
- MeasureRelationModel.ChildLabel child = (MeasureRelationModel.ChildLabel)button.Tag;
- this.drawToolType = child.drawToolType;
- this.UpdateRightSettingUI();
- }
- # region 更新右侧设置
- /// <summary>
- /// 更新右侧设置
- /// </summary>
- private void UpdateRightSettingUI()
- {
- switch (this.drawToolType)
- {
- case DrawToolType.MeasureLine: //长度测量直线
- MeasureStyleModel.MeasureLine measureLine = this.measureStyleModel.measureLine;
- this.panel2.Visible = true;
- this.panel3.Visible = false;
- this.label5.Visible = true;
- this.label6.Visible = true;
- this.comboBox5.Visible = true;
- this.numericUpDown1.Visible = true;
- this.label91.Visible = false;
- this.comboBox91.Visible = false;
- UpdataFontPosition(false);
- this.UpdateMeasureStyleData(measureLine.font, measureLine.fontSize, measureLine.textColor, measureLine.lineColor, measureLine.lineWidth, measureLine.lineStyle, measureLine.linePosition, 0, 0, measureLine.vLineLength, measureLine.followLine);
- break;
- case DrawToolType.MeasureDistanceLine: //长度测量距离
- MeasureStyleModel.MeasureDistanceLine measureDistanceLine = this.measureStyleModel.measureDistanceLine;
- this.panel2.Visible = true;
- this.panel3.Visible = false;
- this.label5.Visible = false;
- this.numericUpDown1.Visible = false;
- this.label6.Visible = false;
- this.comboBox5.Visible = false;
- this.label91.Visible = false;
- this.comboBox91.Visible = false;
- UpdataFontPosition(false);
- this.UpdateMeasureStyleData(measureDistanceLine.font, measureDistanceLine.fontSize, measureDistanceLine.textColor, measureDistanceLine.lineColor, measureDistanceLine.lineWidth, measureDistanceLine.lineStyle, measureDistanceLine.linePosition, 0, 0, -1);
- break;
- case DrawToolType.MeasureLength: //长度测量->长度
- MeasureStyleModel.MeasureLength measureLength = this.measureStyleModel.measureLength;
- this.panel2.Visible = true;
- this.panel3.Visible = false;
- this.label5.Visible = false;
- this.numericUpDown1.Visible = false;
- this.label6.Visible = false;
- this.comboBox5.Visible = false;
- this.label91.Visible = false;
- this.comboBox91.Visible = false;
- UpdataFontPosition(false);
- this.UpdateMeasureStyleData(measureLength.font, measureLength.fontSize, measureLength.textColor, measureLength.lineColor, measureLength.lineWidth, measureLength.lineStyle, measureLength.linePosition, 0, 0, -1);
- break;
- case DrawToolType.MeasureHLine: //长度测量->水平线
- MeasureStyleModel.MeasureHLine measureHLine = this.measureStyleModel.measureHLine;
- this.panel2.Visible = true;
- this.panel3.Visible = false;
- this.label5.Visible = true;
- this.numericUpDown1.Visible = true;
- this.label6.Visible = false;
- this.comboBox5.Visible = false;
- this.label91.Visible = false;
- this.comboBox91.Visible = false;
- UpdataFontPosition(false);
- this.UpdateMeasureStyleData(measureHLine.font, measureHLine.fontSize, measureHLine.textColor, measureHLine.lineColor, measureHLine.lineWidth, measureHLine.lineStyle, measureHLine.linePosition, 0, 0, measureHLine.vLineLength);
- break;
- case DrawToolType.MeasureVLine: //长度测量->垂线
- MeasureStyleModel.MeasureVLine measureVLine = this.measureStyleModel.measureVLine;
- this.panel2.Visible = true;
- this.panel3.Visible = false;
- this.label5.Visible = true;
- this.numericUpDown1.Visible = true;
- this.label6.Visible = true;
- this.comboBox5.Visible = true;
- this.label91.Visible = false;
- this.comboBox91.Visible = false;
- UpdataFontPosition(false);
- this.UpdateMeasureStyleData(measureVLine.font, measureVLine.fontSize, measureVLine.textColor, measureVLine.lineColor, measureVLine.lineWidth, measureVLine.lineStyle, measureVLine.linePosition, 0, 0, measureVLine.vLineLength, measureVLine.followLine);
- break;
- }
- }
- #endregion
- private void UpdataFontPosition(bool curve)
- {
- List<string> position = new List<string> { PdnResources.GetString("Menu.Upperleft.text")
- , PdnResources.GetString("Menu.Uppermiddle.Text")
- , PdnResources.GetString("Menu.Upperright.text")
- , PdnResources.GetString("Menu.Lowerleft.text")
- , PdnResources.GetString("Menu.Themiddleandlower.Text")
- , PdnResources.GetString("Menu.Lowerright.text")};
- List<string> position1 = new List<string> { PdnResources.GetString("Menu.hestartingpoint.Text")
- , PdnResources.GetString("Menu.Theendpoint.Text")
- };
- this.comboBox2.DataSource = null;
- if (curve)
- this.comboBox2.DataSource = position1;
- else
- this.comboBox2.DataSource = position;
- }
- /// <summary>
- /// 刷新右侧预览图
- /// </summary>
- private void UpdateRightPreview()
- {
- }
- /// <summary>
- /// 更新显示区域控件的数值
- /// </summary>
- /// <param name="font"></param>
- /// <param name="fontSize"></param>
- /// <param name="textColor"></param>
- /// <param name="lineColor"></param>
- /// <param name="lineWidth"></param>
- /// <param name="lineStyle"></param>
- 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)
- {
- //绑定样式默认数据
- this.comboBox11.Text = font;
- this.numericUpDown21.Value = fontSize;
- this.textPanel.BackColor = Color.FromArgb(textColor);
- this.linePanel.BackColor = Color.FromArgb(lineColor);
- this.numericUpDown11.Value = lineWidth;
- this.comboBox21.SelectedIndex = lineStyle;
- if (this.comboBox2.Items.Count > 0)
- this.comboBox2.SelectedIndex = linePosition;
- if (this.comboBox3.Items.Count > 0)
- this.comboBox3.SelectedIndex = linePositionL;
- if (this.comboBox4.Items.Count > 0)
- this.comboBox4.SelectedIndex = linePositionP;
- if (vLineLength > -1)
- this.numericUpDown1.Value = vLineLength;
- if (followLine)
- {
- this.comboBox5.SelectedIndex = 0;
- }
- else
- {
- this.comboBox5.SelectedIndex = 1;
- }
- this.comboBox91.SelectedIndex = isAngle ? 1 : 0;
- }
- /// <summary>
- /// 保存按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button2_Click(object sender, EventArgs e)
- {
- //调用检查类型
- this.checkSaveModel();
- //以下保存xml文件信息
- string stageModelXml = XmlSerializeHelper.XmlSerialize<MeasureStyleModel>(this.measureStyleModel);
- string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Measure\\" + this.comboBox1.Text + ".xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- this.config.MarkpointWidth = Convert.ToInt32(this.numericUpDown71.Value);
- string configModelXml = XmlSerializeHelper.XmlSerialize<ConfigModel>(config);
- FileOperationHelper.WriteStringToFile(configModelXml, Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Config.xml", FileMode.Create);
- MarkPointRect.markPointRectWidth = configModel.MarkpointWidth;
- if (this.appWorkspace.DocumentWorkspaces != null)
- {
- foreach (var item in this.appWorkspace.DocumentWorkspaces)
- {
- if (item != null && item.GraphicsList != null)
- foreach (var graObject in item.GraphicsList.graphicsList)
- {
- graObject.smallRectangleWidth = this.config.MarkpointWidth;
- }
- item.Refresh();
- }
- }
- ApplicationSetting();
- }
- /// <summary>
- ///另存为按钮点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button3_Click(object sender, EventArgs e)
- {
- dialog = new CreateNameDialog(this);
- dialog.Text = PdnResources.GetString("Menu.Set.Watermarksettings.Newstyle.text");
- dialog.StartPosition = FormStartPosition.CenterParent;
- dialog.ShowDialog();
- }
- /// <summary>
- /// 当前操作样式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
-
- measureStyleModel = XmlSerializeHelper.DESerializer<MeasureStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Measure\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
-
- InitializeData();
- }
- /// <summary>
- /// 绑定样式下拉
- /// </summary>
- private void InitializeStyleName()
- {
- List<string> fileNames = FileOperationHelper.GetFileList(Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Measure\\");
- files.Clear();
- foreach (string fileName in fileNames)
- {
- string name = fileName.Substring(0, fileName.LastIndexOf("."));
- files.Add(name);
- }
- this.comboBox1.SelectedIndexChanged -= this.comboBox1_SelectedIndexChanged;
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = files;
- string nowModelName = Program.instance.configModel.Watermark.Substring(0, Program.instance.configModel.Watermark.LastIndexOf("."));
- this.comboBox1.SelectedIndex = files.FindIndex(a => a.Equals(nowModelName));
- measureStyleModel = XmlSerializeHelper.DESerializer<MeasureStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Measure\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
- // InitializeData();
- this.comboBox1.SelectedIndexChanged += new EventHandler(this.comboBox1_SelectedIndexChanged);
- }
- /// <summary>
- /// 删除按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button4_Click(object sender, EventArgs e)
- {
- if ("Default".Equals(this.comboBox1.Text))
- {
- MessageBox.Show(PdnResources.GetString("Menu.efaultstylecannotbedelete.Text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.nfirmthedeleti.Text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- if (dr == DialogResult.OK)
- {
- int newIndex = 0;
- int selectIndex = this.comboBox1.SelectedIndex;
- int tall = files.Count - 1;
- if (selectIndex < tall)
- {
- newIndex = selectIndex;
- }
- string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Measure\\" + this.comboBox1.Text + ".xml";
- FileInfo fileInfo = new FileInfo(filePath);
- fileInfo.Delete();
- InitializeStyleName();
- this.comboBox1.SelectedIndex = newIndex;
- measureStyleModel = XmlSerializeHelper.DESerializer<MeasureStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Measure\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
- InitializeData();
- }
- else if (dr == DialogResult.Cancel)
- {
- }
- }
- /// <summary>
- /// 弹出另存为框点击保存效果
- /// </summary>
- /// <param name="name"></param>
- public override void GetCreateName(string name)
- {
- string currentcomboBox = this.comboBox1.Text;
- this.newName = name;
- if (files.Contains(this.newName))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Stylenamecannotberepeated.text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- CopyConfigAndRename();
- InitializeStyleName();
- this.comboBox1.Text = currentcomboBox;
- dialog.Close();
- }
- /// <summary>
- /// 另存配置文件
- /// </summary>
- private void CopyConfigAndRename()
- {
- /*if (this.checkBox1.Checked)
- {
- this.watermarkModel.bold = 1;
- }
- else
- {
- this.watermarkModel.bold = 2;
- }
- if (this.checkBox2.Checked)
- {
- this.watermarkModel.italic = 1;
- }
- else
- {
- this.watermarkModel.italic = 2;
- }
- this.watermarkModel.position = this.comboBox2.SelectedIndex + 1;
- this.watermarkModel.typeface = this.comboBox3.Text;
- this.watermarkModel.fontSize = Int32.Parse(this.comboBox4.Text);*/
- //检查保存类型
- this.checkSaveModel();
- //另存为
- string stageModelXml = XmlSerializeHelper.XmlSerialize<MeasureStyleModel>(this.measureStyleModel);
- string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Measure\\" + this.newName + ".xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- }
- /// <summary>
- /// 应用按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ApplicationSetting()
- {
- //修改缓存中的样式数据
- Program.instance.measureStyleModel = this.measureStyleModel;
- //修改主配置文件中的值
- configModel.MeasurementStyle = this.comboBox1.Text + ".xml";
- //修改主配置文件的xml
- string configModelXml = XmlSerializeHelper.XmlSerialize<ConfigModel>(this.configModel);
- string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Config.xml";
- FileOperationHelper.WriteStringToFile(configModelXml, filePath, FileMode.Create);
- MessageBox.Show(PdnResources.GetString("Menu.Successfullysaved.text"));
- }
- private void textColorPanel_Click(object sender, EventArgs e)
- {
- this.colorsForm.UserPrimaryColor = ColorBgra.FromColor(this.textPanel.BackColor);
- this.colorsForm.setSaveBtn_Click(new System.EventHandler(this.textColorChanged));
- this.colorsForm.ShowDialog();
- }
- private void textColorChanged(object sender, EventArgs e)
- {
- this.textPanel.BackColor = this.colorsForm.UserPrimaryColor.ToColor();
- //this.measureStyleModel.backColor = this.colorsForm.UserPrimaryColor.ToColor().ToArgb();
- this.colorsForm.Close();
- }
- private void lineColorPanel_Click(object sender, EventArgs e)
- {
- this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.linePanel.BackColor);
- this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.lineColorChanged));
- this.colorsForm1.ShowDialog();
- }
- private void lineColorChanged(object sender, EventArgs e)
- {
- this.linePanel.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
- // this.measureStyleModel.backColor = this.colorsForm.UserPrimaryColor.ToColor().ToArgb();
- this.colorsForm1.Close();
- }
- private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
- {
- }
- /// <summary>
- /// 检查保存类型
- /// </summary>
- private void checkSaveModel()
- {
- string font = comboBox11.Text;
- int fontSize = Convert.ToInt32(numericUpDown21.Value);
- int textColor = Convert.ToInt32(this.textPanel.BackColor.ToArgb());
- int lineColor = Convert.ToInt32(this.linePanel.BackColor.ToArgb());
- int lineWidth = Convert.ToInt32(numericUpDown11.Value);
- int lineStyle = this.comboBox21.SelectedIndex;
- int linePosition = this.comboBox2.SelectedIndex;
- int linePositionL = this.comboBox3.SelectedIndex;
- int linePositionP = this.comboBox4.SelectedIndex;
- int vLineLength = Convert.ToInt32(this.numericUpDown1.Value);
- bool isAngle = comboBox91.SelectedIndex == 0 ? false : true;
- switch (this.drawToolType)
- {
- case DrawToolType.MeasureLine: //长度测量直线
- this.measureStyleModel.measureLine.font = font;
- this.measureStyleModel.measureLine.fontSize = fontSize;
- this.measureStyleModel.measureLine.textColor = textColor;
- this.measureStyleModel.measureLine.lineColor = lineColor;
- this.measureStyleModel.measureLine.lineWidth = lineWidth;
- this.measureStyleModel.measureLine.lineStyle = lineStyle;
- this.measureStyleModel.measureLine.linePosition = linePosition;
- this.measureStyleModel.measureLine.vLineLength = vLineLength;
- this.measureStyleModel.measureLine.followLine = this.comboBox5.SelectedIndex == 0 ? true : false;
- break;
- case DrawToolType.MeasureDistanceLine: //距离
- this.measureStyleModel.measureDistanceLine.font = font;
- this.measureStyleModel.measureDistanceLine.fontSize = fontSize;
- this.measureStyleModel.measureDistanceLine.textColor = textColor;
- this.measureStyleModel.measureDistanceLine.lineColor = lineColor;
- this.measureStyleModel.measureDistanceLine.lineWidth = lineWidth;
- this.measureStyleModel.measureDistanceLine.lineStyle = lineStyle;
- this.measureStyleModel.measureDistanceLine.linePosition = linePosition;
- break;
- case DrawToolType.MeasureLength: //长度测量->长度
- this.measureStyleModel.measureLength.font = font;
- this.measureStyleModel.measureLength.fontSize = fontSize;
- this.measureStyleModel.measureLength.textColor = textColor;
- this.measureStyleModel.measureLength.lineColor = lineColor;
- this.measureStyleModel.measureLength.lineWidth = lineWidth;
- this.measureStyleModel.measureLength.lineStyle = lineStyle;
- this.measureStyleModel.measureLength.linePosition = linePosition;
- break;
- case DrawToolType.MeasureHLine: //长度测量->水平线
- this.measureStyleModel.measureHLine.font = font;
- this.measureStyleModel.measureHLine.fontSize = fontSize;
- this.measureStyleModel.measureHLine.textColor = textColor;
- this.measureStyleModel.measureHLine.lineColor = lineColor;
- this.measureStyleModel.measureHLine.lineWidth = lineWidth;
- this.measureStyleModel.measureHLine.lineStyle = lineStyle;
- this.measureStyleModel.measureHLine.linePosition = linePosition;
- this.measureStyleModel.measureHLine.vLineLength = vLineLength;
- break;
- case DrawToolType.MeasureVLine: //长度测量->垂线
- this.measureStyleModel.measureVLine.font = font;
- this.measureStyleModel.measureVLine.fontSize = fontSize;
- this.measureStyleModel.measureVLine.textColor = textColor;
- this.measureStyleModel.measureVLine.lineColor = lineColor;
- this.measureStyleModel.measureVLine.lineWidth = lineWidth;
- this.measureStyleModel.measureVLine.lineStyle = lineStyle;
- this.measureStyleModel.measureVLine.linePosition = linePosition;
- this.measureStyleModel.measureVLine.vLineLength = vLineLength;
- this.measureStyleModel.measureVLine.followLine = this.comboBox5.SelectedIndex == 0 ? true : false;
- break;
- }
- }
- /// <summary>
- /// 应用全部
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- string font = comboBox11.Text;
- int fontSize = Convert.ToInt32(numericUpDown21.Value);
- int textColor = Convert.ToInt32(this.textPanel.BackColor.ToArgb());
- int lineColor = Convert.ToInt32(this.linePanel.BackColor.ToArgb());
- int lineWidth = Convert.ToInt32(numericUpDown11.Value);
- int lineStyle = this.comboBox21.SelectedIndex;
- int linePosition = this.comboBox2.SelectedIndex;
- int linePositionL = this.comboBox3.SelectedIndex;
- int linePositionP = this.comboBox4.SelectedIndex;
- int vLineLength = Convert.ToInt32(this.numericUpDown1.Value);
- bool isAngle = comboBox91.SelectedIndex == 0 ? false : true;
- switch (this.selectId)
- {
- // 直线测量
- case 1:
- this.measureStyleModel.measureLine.font = font;
- this.measureStyleModel.measureLine.fontSize = fontSize;
- this.measureStyleModel.measureLine.textColor = textColor;
- this.measureStyleModel.measureLine.lineColor = lineColor;
- this.measureStyleModel.measureLine.lineWidth = lineWidth;
- this.measureStyleModel.measureLine.lineStyle = lineStyle;
- this.measureStyleModel.measureLine.linePosition = linePosition;
- this.measureStyleModel.measureLine.vLineLength = vLineLength;
- this.measureStyleModel.measureLine.followLine = this.comboBox5.SelectedIndex == 0 ? true : false;
- this.measureStyleModel.measureDistanceLine.font = font;
- this.measureStyleModel.measureDistanceLine.fontSize = fontSize;
- this.measureStyleModel.measureDistanceLine.textColor = textColor;
- this.measureStyleModel.measureDistanceLine.lineColor = lineColor;
- this.measureStyleModel.measureDistanceLine.lineWidth = lineWidth;
- this.measureStyleModel.measureDistanceLine.lineStyle = lineStyle;
- this.measureStyleModel.measureDistanceLine.linePosition = linePosition;
- this.measureStyleModel.measureLength.font = font;
- this.measureStyleModel.measureLength.fontSize = fontSize;
- this.measureStyleModel.measureLength.textColor = textColor;
- this.measureStyleModel.measureLength.lineColor = lineColor;
- this.measureStyleModel.measureLength.lineWidth = lineWidth;
- this.measureStyleModel.measureLength.lineStyle = lineStyle;
- this.measureStyleModel.measureLength.linePosition = linePosition;
- this.measureStyleModel.measureHLine.font = font;
- this.measureStyleModel.measureHLine.fontSize = fontSize;
- this.measureStyleModel.measureHLine.textColor = textColor;
- this.measureStyleModel.measureHLine.lineColor = lineColor;
- this.measureStyleModel.measureHLine.lineWidth = lineWidth;
- this.measureStyleModel.measureHLine.lineStyle = lineStyle;
- this.measureStyleModel.measureHLine.linePosition = linePosition;
- this.measureStyleModel.measureHLine.vLineLength = vLineLength;
- this.measureStyleModel.measureVLine.font = font;
- this.measureStyleModel.measureVLine.fontSize = fontSize;
- this.measureStyleModel.measureVLine.textColor = textColor;
- this.measureStyleModel.measureVLine.lineColor = lineColor;
- this.measureStyleModel.measureVLine.lineWidth = lineWidth;
- this.measureStyleModel.measureVLine.lineStyle = lineStyle;
- this.measureStyleModel.measureVLine.linePosition = linePosition;
- this.measureStyleModel.measureVLine.vLineLength = vLineLength;
- this.measureStyleModel.measureVLine.followLine = this.comboBox5.SelectedIndex == 0 ? true : false;
- break;
- }
- //以下保存xml文件信息
- string stageModelXml = XmlSerializeHelper.XmlSerialize<MeasureStyleModel>(this.measureStyleModel);
- string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Measure\\" + this.comboBox1.Text + ".xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- ApplicationSetting();
- }
- }
- }
|