12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253 |
- 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.Maximum = new decimal(new int[] {
- 49000,
- 0,
- 0,
- 0});
- 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)
- {
- }
- }
- }
|