123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248 |
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.Base.CommTool;
- 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 PaintDotNet.Setting
- {
- public partial class WorkTypeSettingDialog : PdnBaseForm
- {
- #region 控件
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.GroupBox groupBox4;
- private System.Windows.Forms.GroupBox groupBox5;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.RadioButton fzxRBF;
- private System.Windows.Forms.RadioButton fzxRBT;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.PictureBox pictureBox;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.RadioButton ljxRBF;
- private System.Windows.Forms.RadioButton ljxRBT;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.RadioButton clxRangeRBF;
- private System.Windows.Forms.RadioButton clxRangeRBT;
- private System.Windows.Forms.Label label10;
- private System.Windows.Forms.Label label11;
- private System.Windows.Forms.Label label14;
- private System.Windows.Forms.Label label13;
- private System.Windows.Forms.RadioButton clxLenRBF;
- private System.Windows.Forms.RadioButton clxLenRBT;
- private System.Windows.Forms.Label label12;
- private System.Windows.Forms.Panel fzxColourPanel;
- private System.Windows.Forms.Panel ljxColourPanel;
- private System.Windows.Forms.Panel clxColourPanel;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Button button2;
- private ComboBox fontComboBox;
- private NumericUpDown fontSizeNumeric;
- private ComboBox styleComboBox;
- private Label label1;
- private Button button4;
- private Button button3;
- private System.Windows.Forms.Button button1;
- private Panel fontColourPanel;
- private NumericUpDown ljxLineWidthNumeric;
- private NumericUpDown fzxLineWidthNumeric;
- private NumericUpDown clxLineWidthNumeric;
- /// <summary>
- /// 字体列表
- /// </summary>
- ArrayList fontsItems = new ArrayList();
- /// <summary>
- /// 调色板测量线
- /// </summary>
- PaintDotNet.ColorsForm colorsFormclx;
- /// <summary>
- /// 调色板辅助线
- /// </summary>
- PaintDotNet.ColorsForm colorsFormfzx;
- /// <summary>
- /// 调色板连接线
- /// </summary>
- PaintDotNet.ColorsForm colorsFormljx;
- /// <summary>
- /// 调色板字体
- /// </summary>
- PaintDotNet.ColorsForm colorsFormfont;
- /// <summary>
- /// 与xml对应得映射类
- /// </summary>
- private WorkTypeStyleModel workTypeStyleModel;
- /// <summary>
- /// 另存为弹出框显示
- /// </summary>
- private CreateNameDialog dialog;
- /// <summary>
- /// 操作样式下拉数据
- /// </summary>
- private List<string> files = new List<string>();
- /// <summary>
- /// 另存为文件名
- /// </summary>
- private string newName;
- private Panel panel1;
- /// <summary>
- /// 初始化标识
- /// </summary>
- private int initflag = 0;
- #endregion
- public WorkTypeSettingDialog()
- {
- InitializeComponent();
- InitializeLanguageText();
- InitializeComponent2();
- InitializeControl();
- InitializeData();
- // 测量出最大的字符大小
- int maxSize = 0;
- System.Drawing.Graphics g = CreateGraphics();
- for (int i = 0; i < fontComboBox.Items.Count; i++)
- {
- fontComboBox.SelectedIndex = i;
- SizeF size = g.MeasureString(fontComboBox.Text, fontComboBox.Font);
- if (maxSize < (int)size.Width)
- {
- maxSize = (int)size.Width;
- }
- }
- fontComboBox.DropDownWidth = fontComboBox.Width;
- if (fontComboBox.DropDownWidth < maxSize)
- {
- fontComboBox.DropDownWidth = maxSize + 15;
- //comboBox1.Width = maxSize;
- }
- }
- #region 初始化控件
- private void InitializeLanguageText()
- {
- this.groupBox2.Text = PdnResources.GetString("Menu.Auxiliarylinesettings.text");
- this.label4.Text = PdnResources.GetString("Menu.display.text") + ":";
- this.fzxRBF.Text = PdnResources.GetString("Menu.no.text");
- this.fzxRBT.Text = PdnResources.GetString("Menu.Yes.text");
- this.label3.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label2.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.groupBox3.Text = PdnResources.GetString("Menu.Set.typesettings.the communicationscablesetting.text");
- this.ljxRBF.Text = PdnResources.GetString("Menu.no.text");
- this.ljxRBT.Text = PdnResources.GetString("Menu.Yes.text");
- this.label7.Text = PdnResources.GetString("Menu.display.text") + ":";
- this.label6.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label5.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.groupBox4.Text = PdnResources.GetString("Menu.Measuringlinesetting.text");
- this.clxRangeRBF.Text = PdnResources.GetString("Menu.no.text");
- this.clxRangeRBT.Text = PdnResources.GetString("Menu.Yes.text");
- this.label10.Text = PdnResources.GetString("Menu.Set.typesettings.Displaymeasuringlinedistance.text") + ":";
- this.label14.Text = PdnResources.GetString("Menu.Fontsize.text") + ":";
- this.label13.Text = PdnResources.GetString("Menu.Font.text") + ":";
- this.clxLenRBF.Text = PdnResources.GetString("Menu.no.text");
- this.clxLenRBT.Text = PdnResources.GetString("Menu.Yes.text");
- this.label12.Text = PdnResources.GetString("Menu.Set.typesettings.Displaythelengthofmeasuringline.text") + ":";
- this.label11.Text = PdnResources.GetString("Menu.fontcolor.text") + ":";
- this.label9.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label8.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.groupBox5.Text = PdnResources.GetString("Menu.Preview.text");
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- 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.application.text");
- this.button1.Text = PdnResources.GetString("Menu.File.Save.Text");
- this.Text = PdnResources.GetString("Menu.Setting.WorkTypeSetting.Text");
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.fzxLineWidthNumeric = new System.Windows.Forms.NumericUpDown();
- this.fzxColourPanel = new System.Windows.Forms.Panel();
- this.label4 = new System.Windows.Forms.Label();
- this.fzxRBF = new System.Windows.Forms.RadioButton();
- this.fzxRBT = new System.Windows.Forms.RadioButton();
- this.label3 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.ljxLineWidthNumeric = new System.Windows.Forms.NumericUpDown();
- this.ljxColourPanel = new System.Windows.Forms.Panel();
- this.ljxRBF = new System.Windows.Forms.RadioButton();
- this.ljxRBT = new System.Windows.Forms.RadioButton();
- this.label7 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.panel1 = new System.Windows.Forms.Panel();
- this.clxRangeRBF = new System.Windows.Forms.RadioButton();
- this.clxRangeRBT = new System.Windows.Forms.RadioButton();
- this.label10 = new System.Windows.Forms.Label();
- this.clxLineWidthNumeric = new System.Windows.Forms.NumericUpDown();
- this.fontColourPanel = new System.Windows.Forms.Panel();
- this.fontSizeNumeric = new System.Windows.Forms.NumericUpDown();
- this.fontComboBox = new System.Windows.Forms.ComboBox();
- this.clxColourPanel = new System.Windows.Forms.Panel();
- this.label14 = new System.Windows.Forms.Label();
- this.label13 = new System.Windows.Forms.Label();
- this.clxLenRBF = new System.Windows.Forms.RadioButton();
- this.clxLenRBT = new System.Windows.Forms.RadioButton();
- this.label12 = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.pictureBox = new System.Windows.Forms.PictureBox();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.styleComboBox = new System.Windows.Forms.ComboBox();
- this.label1 = new System.Windows.Forms.Label();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.groupBox2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.fzxLineWidthNumeric)).BeginInit();
- this.groupBox3.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.ljxLineWidthNumeric)).BeginInit();
- this.groupBox4.SuspendLayout();
- this.panel1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.clxLineWidthNumeric)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.fontSizeNumeric)).BeginInit();
- this.groupBox5.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
- this.groupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.fzxLineWidthNumeric);
- this.groupBox2.Controls.Add(this.fzxColourPanel);
- this.groupBox2.Controls.Add(this.label4);
- this.groupBox2.Controls.Add(this.fzxRBF);
- this.groupBox2.Controls.Add(this.fzxRBT);
- this.groupBox2.Controls.Add(this.label3);
- this.groupBox2.Controls.Add(this.label2);
- this.groupBox2.Location = new System.Drawing.Point(12, 76);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(509, 79);
- this.groupBox2.TabIndex = 2;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "辅助线设置";
- //
- // fzxLineWidthNumeric
- //
- this.fzxLineWidthNumeric.Location = new System.Drawing.Point(333, 17);
- this.fzxLineWidthNumeric.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.fzxLineWidthNumeric.Name = "fzxLineWidthNumeric";
- this.fzxLineWidthNumeric.Size = new System.Drawing.Size(161, 21);
- this.fzxLineWidthNumeric.TabIndex = 23;
- this.fzxLineWidthNumeric.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- //
- // fzxColourPanel
- //
- this.fzxColourPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight;
- this.fzxColourPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.fzxColourPanel.Location = new System.Drawing.Point(70, 17);
- this.fzxColourPanel.Name = "fzxColourPanel";
- this.fzxColourPanel.Size = new System.Drawing.Size(161, 21);
- this.fzxColourPanel.TabIndex = 8;
- this.fzxColourPanel.Click += new System.EventHandler(this.fzxColorPanel_Click);
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(18, 50);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(46, 23);
- this.label4.TabIndex = 7;
- this.label4.Text = "显示:";
- //
- // fzxRBF
- //
- this.fzxRBF.AutoSize = true;
- this.fzxRBF.Location = new System.Drawing.Point(164, 48);
- this.fzxRBF.Name = "fzxRBF";
- this.fzxRBF.Size = new System.Drawing.Size(35, 16);
- this.fzxRBF.TabIndex = 6;
- this.fzxRBF.TabStop = true;
- this.fzxRBF.Text = "否";
- this.fzxRBF.UseVisualStyleBackColor = true;
- //
- // fzxRBT
- //
- this.fzxRBT.AutoSize = true;
- this.fzxRBT.Checked = true;
- this.fzxRBT.Location = new System.Drawing.Point(70, 48);
- this.fzxRBT.Name = "fzxRBT";
- this.fzxRBT.Size = new System.Drawing.Size(35, 16);
- this.fzxRBT.TabIndex = 5;
- this.fzxRBT.TabStop = true;
- this.fzxRBT.Text = "是";
- this.fzxRBT.UseVisualStyleBackColor = true;
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(281, 20);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(46, 23);
- this.label3.TabIndex = 4;
- this.label3.Text = "线宽:";
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(18, 17);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(46, 23);
- this.label2.TabIndex = 1;
- this.label2.Text = "颜色:";
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.ljxLineWidthNumeric);
- this.groupBox3.Controls.Add(this.ljxColourPanel);
- this.groupBox3.Controls.Add(this.ljxRBF);
- this.groupBox3.Controls.Add(this.ljxRBT);
- this.groupBox3.Controls.Add(this.label7);
- this.groupBox3.Controls.Add(this.label6);
- this.groupBox3.Controls.Add(this.label5);
- this.groupBox3.Location = new System.Drawing.Point(12, 161);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(509, 79);
- this.groupBox3.TabIndex = 3;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "连接线设置";
- //
- // ljxLineWidthNumeric
- //
- this.ljxLineWidthNumeric.Location = new System.Drawing.Point(335, 20);
- this.ljxLineWidthNumeric.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.ljxLineWidthNumeric.Name = "ljxLineWidthNumeric";
- this.ljxLineWidthNumeric.Size = new System.Drawing.Size(161, 21);
- this.ljxLineWidthNumeric.TabIndex = 22;
- this.ljxLineWidthNumeric.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- //
- // ljxColourPanel
- //
- this.ljxColourPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight;
- this.ljxColourPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.ljxColourPanel.Location = new System.Drawing.Point(70, 20);
- this.ljxColourPanel.Name = "ljxColourPanel";
- this.ljxColourPanel.Size = new System.Drawing.Size(161, 21);
- this.ljxColourPanel.TabIndex = 11;
- this.ljxColourPanel.Click += new System.EventHandler(this.ljxColorPanel_Click);
- //
- // ljxRBF
- //
- this.ljxRBF.AutoSize = true;
- this.ljxRBF.Location = new System.Drawing.Point(164, 49);
- this.ljxRBF.Name = "ljxRBF";
- this.ljxRBF.Size = new System.Drawing.Size(35, 16);
- this.ljxRBF.TabIndex = 10;
- this.ljxRBF.TabStop = true;
- this.ljxRBF.Text = "否";
- this.ljxRBF.UseVisualStyleBackColor = true;
- //
- // ljxRBT
- //
- this.ljxRBT.AutoSize = true;
- this.ljxRBT.Checked = true;
- this.ljxRBT.Location = new System.Drawing.Point(70, 47);
- this.ljxRBT.Name = "ljxRBT";
- this.ljxRBT.Size = new System.Drawing.Size(35, 16);
- this.ljxRBT.TabIndex = 9;
- this.ljxRBT.TabStop = true;
- this.ljxRBT.Text = "是";
- this.ljxRBT.UseVisualStyleBackColor = true;
- //
- // label7
- //
- this.label7.Location = new System.Drawing.Point(18, 49);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(46, 23);
- this.label7.TabIndex = 8;
- this.label7.Text = "显示:";
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(281, 23);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(46, 23);
- this.label6.TabIndex = 5;
- this.label6.Text = "线宽:";
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(18, 20);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(46, 23);
- this.label5.TabIndex = 2;
- this.label5.Text = "颜色:";
- //
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.panel1);
- this.groupBox4.Controls.Add(this.clxLineWidthNumeric);
- this.groupBox4.Controls.Add(this.fontColourPanel);
- this.groupBox4.Controls.Add(this.fontSizeNumeric);
- this.groupBox4.Controls.Add(this.fontComboBox);
- this.groupBox4.Controls.Add(this.clxColourPanel);
- this.groupBox4.Controls.Add(this.label14);
- this.groupBox4.Controls.Add(this.label13);
- this.groupBox4.Controls.Add(this.clxLenRBF);
- this.groupBox4.Controls.Add(this.clxLenRBT);
- this.groupBox4.Controls.Add(this.label12);
- this.groupBox4.Controls.Add(this.label11);
- this.groupBox4.Controls.Add(this.label9);
- this.groupBox4.Controls.Add(this.label8);
- this.groupBox4.Location = new System.Drawing.Point(12, 246);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(509, 100);
- this.groupBox4.TabIndex = 4;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "测量线设置";
- //
- // panel1
- //
- this.panel1.Controls.Add(this.clxRangeRBF);
- this.panel1.Controls.Add(this.clxRangeRBT);
- this.panel1.Controls.Add(this.label10);
- this.panel1.Location = new System.Drawing.Point(16, 41);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(211, 28);
- this.panel1.TabIndex = 24;
- //
- // clxRangeRBF
- //
- this.clxRangeRBF.AutoSize = true;
- this.clxRangeRBF.Location = new System.Drawing.Point(150, 5);
- this.clxRangeRBF.Name = "clxRangeRBF";
- this.clxRangeRBF.Size = new System.Drawing.Size(14, 13);
- this.clxRangeRBF.TabIndex = 11;
- this.clxRangeRBF.TabStop = true;
- this.clxRangeRBF.UseVisualStyleBackColor = true;
- //
- // clxRangeRBT
- //
- this.clxRangeRBT.AutoSize = true;
- this.clxRangeRBT.Checked = true;
- this.clxRangeRBT.Location = new System.Drawing.Point(109, 5);
- this.clxRangeRBT.Name = "clxRangeRBT";
- this.clxRangeRBT.Size = new System.Drawing.Size(14, 13);
- this.clxRangeRBT.TabIndex = 10;
- this.clxRangeRBT.TabStop = true;
- this.clxRangeRBT.UseVisualStyleBackColor = true;
- //
- // label10
- //
- this.label10.Location = new System.Drawing.Point(3, 5);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(112, 19);
- this.label10.TabIndex = 9;
- this.label10.Text = "显示测量线距离:";
- //
- // clxLineWidthNumeric
- //
- this.clxLineWidthNumeric.Location = new System.Drawing.Point(335, 14);
- this.clxLineWidthNumeric.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.clxLineWidthNumeric.Name = "clxLineWidthNumeric";
- this.clxLineWidthNumeric.Size = new System.Drawing.Size(161, 21);
- this.clxLineWidthNumeric.TabIndex = 23;
- this.clxLineWidthNumeric.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- //
- // fontColourPanel
- //
- this.fontColourPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight;
- this.fontColourPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.fontColourPanel.Location = new System.Drawing.Point(335, 41);
- this.fontColourPanel.Name = "fontColourPanel";
- this.fontColourPanel.Size = new System.Drawing.Size(161, 23);
- this.fontColourPanel.TabIndex = 22;
- this.fontColourPanel.Click += new System.EventHandler(this.fontColorPanel_Click);
- //
- // fontSizeNumeric
- //
- this.fontSizeNumeric.Location = new System.Drawing.Point(441, 69);
- this.fontSizeNumeric.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.fontSizeNumeric.Name = "fontSizeNumeric";
- this.fontSizeNumeric.Size = new System.Drawing.Size(55, 21);
- this.fontSizeNumeric.TabIndex = 21;
- this.fontSizeNumeric.Value = new decimal(new int[] {
- 12,
- 0,
- 0,
- 0});
- //
- // fontComboBox
- //
- this.fontComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.fontComboBox.FormattingEnabled = true;
- this.fontComboBox.Location = new System.Drawing.Point(335, 70);
- this.fontComboBox.Name = "fontComboBox";
- this.fontComboBox.Size = new System.Drawing.Size(57, 20);
- this.fontComboBox.TabIndex = 20;
- //
- // clxColourPanel
- //
- this.clxColourPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight;
- this.clxColourPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.clxColourPanel.Location = new System.Drawing.Point(70, 14);
- this.clxColourPanel.Name = "clxColourPanel";
- this.clxColourPanel.Size = new System.Drawing.Size(161, 21);
- this.clxColourPanel.TabIndex = 19;
- this.clxColourPanel.Click += new System.EventHandler(this.clxColorPanel_Click);
- //
- // label14
- //
- this.label14.Location = new System.Drawing.Point(398, 71);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(45, 23);
- this.label14.TabIndex = 18;
- this.label14.Text = "字号:";
- //
- // label13
- //
- this.label13.Location = new System.Drawing.Point(281, 74);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(45, 23);
- this.label13.TabIndex = 17;
- this.label13.Text = "字体:";
- //
- // clxLenRBF
- //
- this.clxLenRBF.AutoSize = true;
- this.clxLenRBF.Location = new System.Drawing.Point(166, 71);
- this.clxLenRBF.Name = "clxLenRBF";
- this.clxLenRBF.Size = new System.Drawing.Size(14, 13);
- this.clxLenRBF.TabIndex = 16;
- this.clxLenRBF.TabStop = true;
- this.clxLenRBF.UseVisualStyleBackColor = true;
- this.clxLenRBF.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
- //
- // clxLenRBT
- //
- this.clxLenRBT.AutoSize = true;
- this.clxLenRBT.Checked = true;
- this.clxLenRBT.Location = new System.Drawing.Point(125, 71);
- this.clxLenRBT.Name = "clxLenRBT";
- this.clxLenRBT.Size = new System.Drawing.Size(14, 13);
- this.clxLenRBT.TabIndex = 15;
- this.clxLenRBT.TabStop = true;
- this.clxLenRBT.UseVisualStyleBackColor = true;
- //
- // label12
- //
- this.label12.Location = new System.Drawing.Point(18, 73);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(113, 23);
- this.label12.TabIndex = 14;
- this.label12.Text = "显示测量线长度:";
- //
- // label11
- //
- this.label11.Location = new System.Drawing.Point(258, 46);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(117, 23);
- this.label11.TabIndex = 12;
- this.label11.Text = "字体颜色:";
- //
- // label9
- //
- this.label9.Location = new System.Drawing.Point(282, 18);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(46, 23);
- this.label9.TabIndex = 6;
- this.label9.Text = "线宽:";
- //
- // label8
- //
- this.label8.Location = new System.Drawing.Point(18, 17);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(46, 23);
- this.label8.TabIndex = 3;
- this.label8.Text = "颜色:";
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.pictureBox);
- this.groupBox5.Location = new System.Drawing.Point(12, 352);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(509, 148);
- this.groupBox5.TabIndex = 5;
- this.groupBox5.TabStop = false;
- this.groupBox5.Text = "预览";
- //
- // pictureBox
- //
- this.pictureBox.Location = new System.Drawing.Point(99, 20);
- this.pictureBox.Name = "pictureBox";
- this.pictureBox.Size = new System.Drawing.Size(306, 122);
- this.pictureBox.TabIndex = 0;
- this.pictureBox.TabStop = false;
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.styleComboBox);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.button4);
- this.groupBox1.Controls.Add(this.button3);
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(12, 12);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(509, 58);
- this.groupBox1.TabIndex = 2;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "操作";
- //
- // styleComboBox
- //
- this.styleComboBox.FormattingEnabled = true;
- this.styleComboBox.Location = new System.Drawing.Point(99, 21);
- this.styleComboBox.Name = "styleComboBox";
- this.styleComboBox.Size = new System.Drawing.Size(80, 20);
- this.styleComboBox.TabIndex = 22;
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(8, 24);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(101, 23);
- this.label1.TabIndex = 9;
- this.label1.Text = "当前操作样式:";
- //
- // button4
- //
- this.button4.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.button4.Location = new System.Drawing.Point(185, 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.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.button3.Location = new System.Drawing.Point(266, 21);
- 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.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.button2.Location = new System.Drawing.Point(428, 21);
- 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);
- //
- // button1
- //
- this.button1.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.button1.Location = new System.Drawing.Point(347, 21);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 0;
- this.button1.Text = "保存";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.Button1_Click);
- //
- // WorkTypeSettingDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(533, 512);
- this.Controls.Add(this.groupBox1);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Name = "WorkTypeSettingDialog";
- this.Text = "工型设置";
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.fzxLineWidthNumeric)).EndInit();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.ljxLineWidthNumeric)).EndInit();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- this.panel1.ResumeLayout(false);
- this.panel1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.clxLineWidthNumeric)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.fontSizeNumeric)).EndInit();
- this.groupBox5.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
- this.groupBox1.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- #endregion
- #region InitializeComponent2
- /// <summary>
- /// 初始化组件
- /// </summary>
- private void InitializeComponent2()
- {
- this.colorsFormljx = new ColorsForm();
- this.colorsFormljx.StartPosition = FormStartPosition.CenterScreen;
- this.colorsFormljx.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- this.colorsFormfzx = new ColorsForm();
- this.colorsFormfzx.StartPosition = FormStartPosition.CenterScreen;
- this.colorsFormfzx.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- this.colorsFormclx = new ColorsForm();
- this.colorsFormclx.StartPosition = FormStartPosition.CenterScreen;
- this.colorsFormclx.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- this.colorsFormfont = new ColorsForm();
- this.colorsFormfont.StartPosition = FormStartPosition.CenterScreen;
- this.colorsFormfont.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- }
- #endregion
-
- /// <summary>
- /// 连接线Panel被点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ljxColorPanel_Click(object sender, EventArgs e)
- {
- this.colorsFormljx.UserPrimaryColor = ColorBgra.FromColor(this.ljxColourPanel.BackColor);
- this.colorsFormljx.setSaveBtn_Click(new System.EventHandler(this.ljxColorChanged));
- this.colorsFormljx.ShowDialog();
- }
- /// <summary>
- /// 连接线Panel的调色板颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ljxColorChanged(object sender, EventArgs e)
- {
- this.ljxColourPanel.BackColor = this.colorsFormljx.UserPrimaryColor.ToColor();
- // this.measureStyleModel.backColor = this.colorsForm.UserPrimaryColor.ToColor().ToArgb();
- this.colorsFormljx.Close();
- }
- private void radioButton8_CheckedChanged(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 测量线Panel被点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void clxColorPanel_Click(object sender, EventArgs e)
- {
- this.colorsFormclx.UserPrimaryColor = ColorBgra.FromColor(this.clxColourPanel.BackColor);
- this.colorsFormclx.setSaveBtn_Click(new System.EventHandler(this.clxColorChanged));
- this.colorsFormclx.ShowDialog();
- }
- /// <summary>
- /// 测量线Panel的调色板颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void clxColorChanged(object sender, EventArgs e)
- {
- this.clxColourPanel.BackColor = this.colorsFormclx.UserPrimaryColor.ToColor();
- // this.measureStyleModel.backColor = this.colorsForm.UserPrimaryColor.ToColor().ToArgb();
- this.colorsFormclx.Close();
- }
- /// <summary>
- /// 处理控件
- /// </summary>
- private void InitializeControl()
- {
- this.pictureBox.Paint += new PaintEventHandler(this.pictureBox_Paint);
- }
- /// <summary>
- /// pictureBox的绘制事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void pictureBox_Paint(object sender, PaintEventArgs e)
- {
- WorkTypeStyleModel model = this.workTypeStyleModel;
- Graphics gps = e.Graphics;
- Pen measurePen = new Pen(this.clxColourPanel.BackColor, Convert.ToInt32(this.clxLineWidthNumeric.Value));
- gps.DrawLine(measurePen, 150, 20 + model.guideLineWidth / 2, 150, 80 - model.connectLineWidth / 2);
- if (model.guideShowFlag == 1)
- {
- Pen guidePen = new Pen(Color.FromArgb(model.guideColour), Convert.ToInt32(model.guideLineWidth));
- gps.DrawLine(guidePen, 50, 20, 250, 20);
- }
- if (model.connectShowFlag == 1) {
- Pen connectPen = new Pen(Color.FromArgb(model.connectColour), model.connectLineWidth);
- gps.DrawLine(connectPen, 50, 80, 250, 80);
- }
-
-
- }
- /// <summary>
- /// 应用按钮被点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button2_Click(object sender, EventArgs e)
- {
- /*//预览展示
- Graphics gps = pictureBox.CreateGraphics();
- // gps.Clear(Color.Empty);
-
- Pen guidePen = new Pen(this.fzxColourPanel.BackColor , Convert.ToInt32(this.fzxLineWidthNumeric.Value));
-
- Pen measurePen = new Pen(this.clxColourPanel.BackColor, Convert.ToInt32(this.clxLineWidthNumeric.Value));
- Pen connectPen = new Pen(this.ljxColourPanel.BackColor, Convert.ToInt32(this.ljxLineWidthNumeric.Value));
-
- gps.DrawLine(measurePen, 150, 20 + Convert.ToInt32(this.fzxLineWidthNumeric.Value)/2, 150, 80 - Convert.ToInt32(this.ljxLineWidthNumeric.Value)/2);
- gps.DrawLine(guidePen, 50, 20, 250, 20);
- gps.DrawLine(connectPen, 50, 80, 250, 80);*/
- //检查数据
- this.checkData();
- this.pictureBox.Invalidate();
- Startup.instance.workTypeStyleModel = this.workTypeStyleModel;
- }
- /// <summary>
- /// 检查数据并且赋值到model中
- /// </summary>
- private void checkData() {
- UpDownBase fzxLineWidthup = (UpDownBase)this.fzxLineWidthNumeric;
- if (string.IsNullOrEmpty(fzxLineWidthup.Text)) {
- this.fzxLineWidthNumeric.Value = 1;
- }
- UpDownBase ljxLineWidthup = (UpDownBase)this.ljxLineWidthNumeric;
- if (string.IsNullOrEmpty(ljxLineWidthup.Text))
- {
- this.ljxLineWidthNumeric.Value = 1;
- }
- UpDownBase clxLineWidthup = (UpDownBase)this.clxLineWidthNumeric;
- if (string.IsNullOrEmpty(clxLineWidthup.Text))
- {
- this.clxLineWidthNumeric.Value = 1;
- }
- UpDownBase fontSizeWidthup = (UpDownBase)this.fontSizeNumeric;
- if (string.IsNullOrEmpty(fontSizeWidthup.Text))
- {
- this.fontSizeNumeric.Value = 1;
- }
- /* if (string.IsNullOrEmpty(fontComboBox.Text)) {
- fontComboBox.Text = this.workTypeStyleModel.font;
- }*/
- //辅助线设置赋值
- this.workTypeStyleModel.guideColour = Convert.ToInt32(this.fzxColourPanel.BackColor.ToArgb());
- this.workTypeStyleModel.guideLineWidth = Convert.ToInt32(this.fzxLineWidthNumeric.Value);
- if (this.fzxRBF.Checked)
- {
- this.workTypeStyleModel.guideShowFlag = 0;
- }
- else
- {
- this.workTypeStyleModel.guideShowFlag = 1;
- }
- //连接线设置赋值
- this.workTypeStyleModel.connectColour = Convert.ToInt32(this.ljxColourPanel.BackColor.ToArgb());
- this.workTypeStyleModel.connectLineWidth = Convert.ToInt32(this.ljxLineWidthNumeric.Value);
- if (this.ljxRBF.Checked)
- {
- this.workTypeStyleModel.connectShowFlag = 0;
- }
- else
- {
- this.workTypeStyleModel.connectShowFlag = 1;
- }
- //测量线设置
- this.workTypeStyleModel.measureColour = Convert.ToInt32(this.clxColourPanel.BackColor.ToArgb());
- this.workTypeStyleModel.measureLineWidth = Convert.ToInt32(this.clxLineWidthNumeric.Value);
- if (this.clxRangeRBF.Checked)
- {
- this.workTypeStyleModel.measureRangeShowFlag = 0;
- }
- else
- {
- this.workTypeStyleModel.measureRangeShowFlag = 1;
- }
- if (this.clxLenRBF.Checked)
- {
- this.workTypeStyleModel.measureLengthShowFlag = 0;
- }
- else
- {
- this.workTypeStyleModel.measureLengthShowFlag = 1;
- }
- this.workTypeStyleModel.fontColour = Convert.ToInt32(this.fontColourPanel.BackColor.ToArgb());
- this.workTypeStyleModel.font = this.fontComboBox.Text;
- this.workTypeStyleModel.fontSize = Convert.ToInt32(this.fontSizeNumeric.Value);
- }
- /// <summary>
- /// 保存按钮被点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button1_Click(object sender, EventArgs e)
- {
- //调用检查方法
- this.checkData();
- //以下保存xml文件信息
- string workTypeStyleModelXml = XmlSerializeHelper.XmlSerialize<WorkTypeStyleModel>(this.workTypeStyleModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkType\\" + this.styleComboBox.Text + ".xml";
- FileOperationHelper.WriteStringToFile(workTypeStyleModelXml, filePath, FileMode.Create);
- }
- /// <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>
- private void InitializeData()
- {
- this.fontsItems.Clear();
- //绑定字体数据
- System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
- foreach (FontFamily fontFamily in fonts.Families)
- {
- fontsItems.Add(fontFamily.Name);
- }
- this.fontComboBox.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.Text = this.measureStyleModel.measureLine.lineStyle;*/
- //绑定样式下拉 todo
- if (initflag++ == 0)
- {
- InitializeStyleName();
- }
- //辅助线设置赋值
- this.fzxColourPanel.BackColor = Color.FromArgb(this.workTypeStyleModel.guideColour);
- this.fzxLineWidthNumeric.Value = this.workTypeStyleModel.guideLineWidth;
- if (this.workTypeStyleModel.guideShowFlag == 0)
- {
- this.fzxRBF.Checked = true;
- }
- else
- {
- this.fzxRBT.Checked = true;
- }
- //连接线设置赋值
- this.ljxColourPanel.BackColor = Color.FromArgb(this.workTypeStyleModel.connectColour);
- this.ljxLineWidthNumeric.Value = this.workTypeStyleModel.connectLineWidth;
- if (this.workTypeStyleModel.connectShowFlag == 0)
- {
- this.ljxRBF.Checked = true;
- }
- else
- {
- this.ljxRBT.Checked = true;
- }
- //测量线设置
- this.clxColourPanel.BackColor = Color.FromArgb(this.workTypeStyleModel.measureColour);
- this.clxLineWidthNumeric.Value = this.workTypeStyleModel.measureLineWidth;
- if (this.workTypeStyleModel.measureRangeShowFlag == 0)
- {
- this.clxRangeRBF.Checked = true;
- }
- else
- {
- this.clxRangeRBT.Checked = true;
- }
- if (this.workTypeStyleModel.measureLengthShowFlag == 0)
- {
- this.clxLenRBF.Checked = true;
- }
- else
- {
- this.clxLenRBT.Checked = true;
- }
- this.fontColourPanel.BackColor = Color.FromArgb(this.workTypeStyleModel.fontColour);
- this.fontComboBox.Text = this.workTypeStyleModel.font;
- this.fontSizeNumeric.Value = this.workTypeStyleModel.fontSize;
- }
- /// <summary>
- /// 调色板回调函数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ce"></param>
- private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
- {
- }
- /// <summary>
- /// 辅助线Panel被点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void fzxColorPanel_Click(object sender, EventArgs e)
- {
- this.colorsFormfzx.UserPrimaryColor = ColorBgra.FromColor(this.fzxColourPanel.BackColor);
- this.colorsFormfzx.setSaveBtn_Click(new System.EventHandler(this.fzxColorChanged));
- this.colorsFormfzx.ShowDialog();
- }
- /// <summary>
- /// 辅助线Panel的调色板颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void fzxColorChanged(object sender, EventArgs e)
- {
- this.fzxColourPanel.BackColor = this.colorsFormfzx.UserPrimaryColor.ToColor();
- // this.measureStyleModel.backColor = this.colorsForm.UserPrimaryColor.ToColor().ToArgb();
- this.colorsFormfzx.Close();
- }
- /// <summary>
- /// 字体颜色Panel被点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void fontColorPanel_Click(object sender, EventArgs e)
- {
- this.colorsFormfont.UserPrimaryColor = ColorBgra.FromColor(this.fontColourPanel.BackColor);
- this.colorsFormfont.setSaveBtn_Click(new System.EventHandler(this.fontColorChanged));
- this.colorsFormfont.ShowDialog();
- }
- /// <summary>
- /// 字体颜色Panel的调色板颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void fontColorChanged(object sender, EventArgs e)
- {
- this.fontColourPanel.BackColor = this.colorsFormfont.UserPrimaryColor.ToColor();
- // this.measureStyleModel.backColor = this.colorsForm.UserPrimaryColor.ToColor().ToArgb();
- this.colorsFormfont.Close();
- }
- /// <summary>
- /// 绑定样式下拉
- /// </summary>
- private void InitializeStyleName()
- {
- List<string> fileNames = FileOperationHelper.GetFileList(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkType\\");
- files.Clear();
- foreach (string fileName in fileNames)
- {
- string name = fileName.Substring(0, fileName.LastIndexOf("."));
- files.Add(name);
- }
- this.styleComboBox.SelectedIndexChanged -= this.comboBox1_SelectedIndexChanged;
- this.styleComboBox.DataSource = null;
- this.styleComboBox.DataSource = files;
- string nowModelName = Startup.instance.configModel.Watermark.Substring(0, Startup.instance.configModel.Watermark.LastIndexOf("."));
- this.styleComboBox.SelectedIndex = files.FindIndex(a => a.Equals(nowModelName));
- this.workTypeStyleModel = XmlSerializeHelper.DESerializer<WorkTypeStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkType\\" + this.styleComboBox.SelectedItem.ToString() + ".xml", FileMode.Open));
- // InitializeData();
- this.styleComboBox.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.styleComboBox.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.styleComboBox.SelectedIndex;
- int tall = files.Count - 1;
- if (selectIndex < tall)
- {
- newIndex = selectIndex;
- }
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkType\\" + this.styleComboBox.Text + ".xml";
- FileInfo fileInfo = new FileInfo(filePath);
- fileInfo.Delete();
- InitializeStyleName();
- this.styleComboBox.SelectedIndex = newIndex;
- workTypeStyleModel = XmlSerializeHelper.DESerializer<WorkTypeStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkType\\" + this.styleComboBox.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.styleComboBox.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.styleComboBox.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();
- //另存为
- //调用检查方法
- this.checkData();
- string stageModelXml = XmlSerializeHelper.XmlSerialize<WorkTypeStyleModel>(this.workTypeStyleModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkType\\" + this.newName + ".xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- }
- /// <summary>
- /// 当前操作样式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- workTypeStyleModel = XmlSerializeHelper.DESerializer<WorkTypeStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkType\\" + this.styleComboBox.SelectedItem.ToString() + ".xml", FileMode.Open));
- InitializeData();
- }
- private void ClxRangeRBT_CheckedChanged(object sender, EventArgs e)
- {
- }
- }
- }
|