| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868 | using PaintDotNet.Annotation;using PaintDotNet.Annotation.Enum;using PaintDotNet.Annotation.Label;using PaintDotNet.Base.CommTool;using PaintDotNet.Base.SettingModel;using System;using System.Collections;using System.Drawing;using System.Windows.Forms;namespace PaintDotNet.ImageLabel{    internal class LabelRulerStyleDialog : PdnBaseForm    {        private Button button1;        private Button button2;        private GroupBox groupBox2;        private Label label1;        private Label label4;        private Label label3;        private Label label2;        private Label label5;        private Label label8;        private Label label7;        private Label label6;        private Label label12;        private Label label11;        private Label label10;        private Label label9;        private GroupBox groupBox3;        private Label label13;        private NumericUpDown numericUpDown1;        private Label label14;        private NumericUpDown numericUpDown3;        private ComboBox comboBox1;        private Panel panel1;        private ComboBox comboBox2;        private Panel panel2;        private Panel panel3;        private NumericUpDown numericUpDown4;        private NumericUpDown numericUpDown6;        private NumericUpDown numericUpDown5;        private Label label18;        private Label label17;        private Panel panel4;        private Panel panel5;        private NumericUpDown numericUpDown7;        private Label label19;        private Panel panel6;        private NumericUpDown numericUpDown8;        private GroupBox groupBox1;        PaintDotNet.ColorsForm colorsFormFont;        PaintDotNet.ColorsForm colorsFormLine;        PaintDotNet.ColorsForm colorsFormBackground;        PaintDotNet.ColorsForm colorsFormBorder;        private AppWorkspace appWorkspace;        private DrawObject drawObject;        private ParentStyleModel parentStyleModel;        private RulerModel rulerModel;        private ComboBox textBold;        private Label label21;        /// <summary>        /// 字体位置下拉        /// </summary>        private string[] textPosition = new string[] { PdnResources.GetString("Menu.Set.Rulersettings.Left.text"), PdnResources.GetString("Menu.nthemiddle.Text"), PdnResources.GetString("Menu.Set.Rulersettings.Right.text") };        public LabelRulerStyleDialog(AppWorkspace appWorkspace, DrawObject drawObject)        {            this.appWorkspace = appWorkspace;            this.drawObject = drawObject;            string rulerXmlNotes = XmlSerializeHelper.XmlSerialize<RulerModel>((RulerModel)this.drawObject.GetStyle());            this.parentStyleModel = DrawRulerHelper.DeserializeXML<RulerModel>(rulerXmlNotes);            InitializeComponent();            InitializeLanguageText();            InitializeData();            InitializeRulerModel();        }        private void InitializeLanguageText()        {            this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");            this.button2.Text = PdnResources.GetString("Menu.cancel.text");            this.button1.Text = PdnResources.GetString("Menu.application.text");            this.groupBox2.Text = PdnResources.GetString("Menu.Set.typesettings.Stylesetting.text");            this.label12.Text = PdnResources.GetString("Menu.Set.Rulersettings.Borderlinewidth.text") + ":";            this.label11.Text = PdnResources.GetString("Menu.Set.Rulersettings.Borderlinecolor.text") + ":";            this.label10.Text = PdnResources.GetString("Menu.Backgroundsize.text") + ":";            this.label9.Text = PdnResources.GetString("Menu.backgroundcolor.text") + ":";            this.label8.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textheight.text") + ":";            this.label7.Text = PdnResources.GetString("Menu.Set.Rulersettings.lengthofperpendicular.text") + ":";            this.label6.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linewidth.text") + ":";            this.label5.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linecolor.text") + ":";            this.label4.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textposition.text") + ":";            this.label3.Text = PdnResources.GetString("Menu.Textcolor.text") + ":";            this.label2.Text = PdnResources.GetString("Menu.Textfont.text") + ":";            this.label1.Text = PdnResources.GetString("Menu.Set.Rulersettings.Fontsize.text") + ":";            this.groupBox3.Text = PdnResources.GetString("Menu.LabelAction.DrawAutoRuler.Text");            this.label14.Text = PdnResources.GetString("Menu.Set.Rulersettings.Dividebymagnification.text");            this.label13.Text = PdnResources.GetString("Menu.Calculationofcalelength.Text") + ":";            this.Text = PdnResources.GetString("Menu.Setting.RuleSetting.Text");        }        private void InitializeComponent()        {            this.groupBox1 = new System.Windows.Forms.GroupBox();            this.button2 = new System.Windows.Forms.Button();            this.button1 = new System.Windows.Forms.Button();            this.groupBox2 = new System.Windows.Forms.GroupBox();            this.textBold = new System.Windows.Forms.ComboBox();            this.label21 = new System.Windows.Forms.Label();            this.numericUpDown8 = new System.Windows.Forms.NumericUpDown();            this.panel6 = new System.Windows.Forms.Panel();            this.label19 = new System.Windows.Forms.Label();            this.numericUpDown7 = new System.Windows.Forms.NumericUpDown();            this.panel5 = new System.Windows.Forms.Panel();            this.panel4 = new System.Windows.Forms.Panel();            this.label18 = new System.Windows.Forms.Label();            this.label17 = new System.Windows.Forms.Label();            this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();            this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();            this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();            this.panel3 = new System.Windows.Forms.Panel();            this.panel2 = new System.Windows.Forms.Panel();            this.comboBox2 = new System.Windows.Forms.ComboBox();            this.panel1 = new System.Windows.Forms.Panel();            this.comboBox1 = new System.Windows.Forms.ComboBox();            this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();            this.label12 = new System.Windows.Forms.Label();            this.label11 = new System.Windows.Forms.Label();            this.label10 = new System.Windows.Forms.Label();            this.label9 = new System.Windows.Forms.Label();            this.label8 = new System.Windows.Forms.Label();            this.label7 = new System.Windows.Forms.Label();            this.label6 = new System.Windows.Forms.Label();            this.label5 = new System.Windows.Forms.Label();            this.label4 = new System.Windows.Forms.Label();            this.label3 = new System.Windows.Forms.Label();            this.label2 = new System.Windows.Forms.Label();            this.label1 = new System.Windows.Forms.Label();            this.groupBox3 = new System.Windows.Forms.GroupBox();            this.label14 = new System.Windows.Forms.Label();            this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();            this.label13 = new System.Windows.Forms.Label();            this.groupBox1.SuspendLayout();            this.groupBox2.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).BeginInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).BeginInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();            this.groupBox3.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();            this.SuspendLayout();            //             // 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.button2);            this.groupBox1.Controls.Add(this.button1);            this.groupBox1.Location = new System.Drawing.Point(13, 13);            this.groupBox1.Name = "groupBox1";            this.groupBox1.Size = new System.Drawing.Size(508, 58);            this.groupBox1.TabIndex = 0;            this.groupBox1.TabStop = false;            this.groupBox1.Text = "操作";            //             // button2            //             this.button2.Location = new System.Drawing.Point(420, 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.Location = new System.Drawing.Point(339, 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);            //             // groupBox2            //             this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.groupBox2.Controls.Add(this.textBold);            this.groupBox2.Controls.Add(this.label21);            this.groupBox2.Controls.Add(this.numericUpDown8);            this.groupBox2.Controls.Add(this.panel6);            this.groupBox2.Controls.Add(this.label19);            this.groupBox2.Controls.Add(this.numericUpDown7);            this.groupBox2.Controls.Add(this.panel5);            this.groupBox2.Controls.Add(this.panel4);            this.groupBox2.Controls.Add(this.label18);            this.groupBox2.Controls.Add(this.label17);            this.groupBox2.Controls.Add(this.numericUpDown6);            this.groupBox2.Controls.Add(this.numericUpDown5);            this.groupBox2.Controls.Add(this.numericUpDown4);            this.groupBox2.Controls.Add(this.panel3);            this.groupBox2.Controls.Add(this.panel2);            this.groupBox2.Controls.Add(this.comboBox2);            this.groupBox2.Controls.Add(this.panel1);            this.groupBox2.Controls.Add(this.comboBox1);            this.groupBox2.Controls.Add(this.numericUpDown3);            this.groupBox2.Controls.Add(this.label12);            this.groupBox2.Controls.Add(this.label11);            this.groupBox2.Controls.Add(this.label10);            this.groupBox2.Controls.Add(this.label9);            this.groupBox2.Controls.Add(this.label8);            this.groupBox2.Controls.Add(this.label7);            this.groupBox2.Controls.Add(this.label6);            this.groupBox2.Controls.Add(this.label5);            this.groupBox2.Controls.Add(this.label4);            this.groupBox2.Controls.Add(this.label3);            this.groupBox2.Controls.Add(this.label2);            this.groupBox2.Controls.Add(this.label1);            this.groupBox2.Location = new System.Drawing.Point(13, 78);            this.groupBox2.Name = "groupBox2";            this.groupBox2.Size = new System.Drawing.Size(508, 183);            this.groupBox2.TabIndex = 1;            this.groupBox2.TabStop = false;            this.groupBox2.Text = "样式设置";            //             // textBold            //             this.textBold.FormattingEnabled = true;            this.textBold.Location = new System.Drawing.Point(76, 151);            this.textBold.Name = "textBold";            this.textBold.Size = new System.Drawing.Size(72, 20);            this.textBold.TabIndex = 57;            //             // label21            //             this.label21.AutoSize = true;            this.label21.Location = new System.Drawing.Point(15, 154);            this.label21.Name = "label21";            this.label21.Size = new System.Drawing.Size(65, 12);            this.label21.TabIndex = 56;            this.label21.Text = "文字加粗:";            //             // numericUpDown8            //             this.numericUpDown8.Location = new System.Drawing.Point(410, 118);            this.numericUpDown8.Name = "numericUpDown8";            this.numericUpDown8.Size = new System.Drawing.Size(72, 21);            this.numericUpDown8.TabIndex = 28;            //             // panel6            //             this.panel6.BackColor = System.Drawing.SystemColors.Window;            this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.panel6.Location = new System.Drawing.Point(410, 87);            this.panel6.Name = "panel6";            this.panel6.Size = new System.Drawing.Size(72, 21);            this.panel6.TabIndex = 27;            this.panel6.Click += new System.EventHandler(this.panel6_Click);            //             // label19            //             this.label19.AutoSize = true;            this.label19.Location = new System.Drawing.Point(471, 59);            this.label19.Name = "label19";            this.label19.Size = new System.Drawing.Size(11, 12);            this.label19.TabIndex = 26;            this.label19.Text = "%";            //             // numericUpDown7            //             this.numericUpDown7.Location = new System.Drawing.Point(410, 54);            this.numericUpDown7.Name = "numericUpDown7";            this.numericUpDown7.Size = new System.Drawing.Size(55, 21);            this.numericUpDown7.TabIndex = 25;            //             // panel5            //             this.panel5.BackColor = System.Drawing.SystemColors.Window;            this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.panel5.Location = new System.Drawing.Point(410, 23);            this.panel5.Name = "panel5";            this.panel5.Size = new System.Drawing.Size(72, 21);            this.panel5.TabIndex = 24;            this.panel5.Click += new System.EventHandler(this.panel5_Click);            //             // panel4            //             this.panel4.BackColor = System.Drawing.SystemColors.WindowText;            this.panel4.Location = new System.Drawing.Point(333, 13);            this.panel4.Name = "panel4";            this.panel4.Size = new System.Drawing.Size(1, 155);            this.panel4.TabIndex = 23;            //             // label18            //             this.label18.AutoSize = true;            this.label18.Location = new System.Drawing.Point(303, 123);            this.label18.Name = "label18";            this.label18.Size = new System.Drawing.Size(11, 12);            this.label18.TabIndex = 22;            this.label18.Text = "%";            //             // label17            //             this.label17.AutoSize = true;            this.label17.Location = new System.Drawing.Point(303, 91);            this.label17.Name = "label17";            this.label17.Size = new System.Drawing.Size(11, 12);            this.label17.TabIndex = 21;            this.label17.Text = "%";            //             // numericUpDown6            //             this.numericUpDown6.Location = new System.Drawing.Point(242, 119);            this.numericUpDown6.Name = "numericUpDown6";            this.numericUpDown6.Size = new System.Drawing.Size(55, 21);            this.numericUpDown6.TabIndex = 20;            //             // numericUpDown5            //             this.numericUpDown5.Location = new System.Drawing.Point(242, 87);            this.numericUpDown5.Name = "numericUpDown5";            this.numericUpDown5.Size = new System.Drawing.Size(55, 21);            this.numericUpDown5.TabIndex = 19;            //             // numericUpDown4            //             this.numericUpDown4.Location = new System.Drawing.Point(242, 55);            this.numericUpDown4.Minimum = new decimal(new int[] {            1,            0,            0,            0});            this.numericUpDown4.Name = "numericUpDown4";            this.numericUpDown4.Size = new System.Drawing.Size(72, 21);            this.numericUpDown4.TabIndex = 18;            this.numericUpDown4.Value = new decimal(new int[] {            1,            0,            0,            0});            //             // panel3            //             this.panel3.BackColor = System.Drawing.SystemColors.Window;            this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.panel3.Location = new System.Drawing.Point(242, 23);            this.panel3.Name = "panel3";            this.panel3.Size = new System.Drawing.Size(72, 21);            this.panel3.TabIndex = 17;            this.panel3.Click += new System.EventHandler(this.panel3_Click);            //             // panel2            //             this.panel2.BackColor = System.Drawing.SystemColors.WindowText;            this.panel2.Location = new System.Drawing.Point(166, 13);            this.panel2.Name = "panel2";            this.panel2.Size = new System.Drawing.Size(1, 155);            this.panel2.TabIndex = 16;            //             // comboBox2            //             this.comboBox2.DropDownWidth = 72;            this.comboBox2.FormattingEnabled = true;            this.comboBox2.Location = new System.Drawing.Point(76, 119);            this.comboBox2.Name = "comboBox2";            this.comboBox2.Size = new System.Drawing.Size(72, 20);            this.comboBox2.TabIndex = 15;            //             // panel1            //             this.panel1.BackColor = System.Drawing.SystemColors.Window;            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.panel1.Location = new System.Drawing.Point(76, 87);            this.panel1.Name = "panel1";            this.panel1.Size = new System.Drawing.Size(72, 21);            this.panel1.TabIndex = 14;            this.panel1.Click += new System.EventHandler(this.panel1_Click);            //             // comboBox1            //             this.comboBox1.FormattingEnabled = true;            this.comboBox1.Location = new System.Drawing.Point(76, 55);            this.comboBox1.Name = "comboBox1";            this.comboBox1.Size = new System.Drawing.Size(72, 20);            this.comboBox1.TabIndex = 13;            //             // numericUpDown3            //             this.numericUpDown3.Location = new System.Drawing.Point(76, 23);            this.numericUpDown3.Maximum = new decimal(new int[] {            49000,            0,            0,            0});            this.numericUpDown3.Minimum = new decimal(new int[] {            1,            0,            0,            0});            this.numericUpDown3.Name = "numericUpDown3";            this.numericUpDown3.Size = new System.Drawing.Size(72, 21);            this.numericUpDown3.TabIndex = 12;            this.numericUpDown3.Value = new decimal(new int[] {            1,            0,            0,            0});            //             // label12            //             this.label12.AutoSize = true;            this.label12.Location = new System.Drawing.Point(349, 123);            this.label12.Name = "label12";            this.label12.Size = new System.Drawing.Size(65, 12);            this.label12.TabIndex = 11;            this.label12.Text = "边框线宽:";            //             // label11            //             this.label11.AutoSize = true;            this.label11.Location = new System.Drawing.Point(349, 91);            this.label11.Name = "label11";            this.label11.Size = new System.Drawing.Size(65, 12);            this.label11.TabIndex = 10;            this.label11.Text = "边框颜色:";            //             // label10            //             this.label10.AutoSize = true;            this.label10.Location = new System.Drawing.Point(349, 59);            this.label10.Name = "label10";            this.label10.Size = new System.Drawing.Size(65, 12);            this.label10.TabIndex = 9;            this.label10.Text = "背景大小:";            //             // label9            //             this.label9.AutoSize = true;            this.label9.Location = new System.Drawing.Point(349, 27);            this.label9.Name = "label9";            this.label9.Size = new System.Drawing.Size(65, 12);            this.label9.TabIndex = 8;            this.label9.Text = "背景颜色:";            //             // label8            //             this.label8.AutoSize = true;            this.label8.Location = new System.Drawing.Point(182, 123);            this.label8.Name = "label8";            this.label8.Size = new System.Drawing.Size(65, 12);            this.label8.TabIndex = 7;            this.label8.Text = "文字高度:";            //             // label7            //             this.label7.AutoSize = true;            this.label7.Location = new System.Drawing.Point(182, 91);            this.label7.Name = "label7";            this.label7.Size = new System.Drawing.Size(65, 12);            this.label7.TabIndex = 6;            this.label7.Text = "垂线长度:";            //             // label6            //             this.label6.AutoSize = true;            this.label6.Location = new System.Drawing.Point(182, 59);            this.label6.Name = "label6";            this.label6.Size = new System.Drawing.Size(65, 12);            this.label6.TabIndex = 5;            this.label6.Text = "线条宽度:";            //             // label5            //             this.label5.AutoSize = true;            this.label5.Location = new System.Drawing.Point(182, 27);            this.label5.Name = "label5";            this.label5.Size = new System.Drawing.Size(65, 12);            this.label5.TabIndex = 4;            this.label5.Text = "线条颜色:";            //             // label4            //             this.label4.AutoSize = true;            this.label4.Location = new System.Drawing.Point(15, 123);            this.label4.Name = "label4";            this.label4.Size = new System.Drawing.Size(65, 12);            this.label4.TabIndex = 3;            this.label4.Text = "文字位置:";            //             // label3            //             this.label3.AutoSize = true;            this.label3.Location = new System.Drawing.Point(15, 91);            this.label3.Name = "label3";            this.label3.Size = new System.Drawing.Size(65, 12);            this.label3.TabIndex = 2;            this.label3.Text = "文字颜色:";            //             // label2            //             this.label2.AutoSize = true;            this.label2.Location = new System.Drawing.Point(15, 59);            this.label2.Name = "label2";            this.label2.Size = new System.Drawing.Size(65, 12);            this.label2.TabIndex = 1;            this.label2.Text = "文字字体:";            //             // label1            //             this.label1.AutoSize = true;            this.label1.Location = new System.Drawing.Point(15, 27);            this.label1.Name = "label1";            this.label1.Size = new System.Drawing.Size(65, 12);            this.label1.TabIndex = 0;            this.label1.Text = "文字字号:";            //             // groupBox3            //             this.groupBox3.Controls.Add(this.label14);            this.groupBox3.Controls.Add(this.numericUpDown1);            this.groupBox3.Controls.Add(this.label13);            this.groupBox3.Location = new System.Drawing.Point(13, 273);            this.groupBox3.Name = "groupBox3";            this.groupBox3.Size = new System.Drawing.Size(508, 61);            this.groupBox3.TabIndex = 2;            this.groupBox3.TabStop = false;            this.groupBox3.Text = "自动标尺";            //             // label14            //             this.label14.AutoSize = true;            this.label14.Location = new System.Drawing.Point(146, 37);            this.label14.Name = "label14";            this.label14.Size = new System.Drawing.Size(77, 12);            this.label14.TabIndex = 2;            this.label14.Text = "除以放大倍数";            //             // numericUpDown1            //             this.numericUpDown1.Location = new System.Drawing.Point(103, 13);            this.numericUpDown1.Maximum = new decimal(new int[] {            99999999,            0,            0,            0});            this.numericUpDown1.Name = "numericUpDown1";            this.numericUpDown1.Size = new System.Drawing.Size(120, 21);            this.numericUpDown1.TabIndex = 1;            //             // label13            //             this.label13.AutoSize = true;            this.label13.Location = new System.Drawing.Point(17, 17);            this.label13.Name = "label13";            this.label13.Size = new System.Drawing.Size(89, 12);            this.label13.TabIndex = 0;            this.label13.Text = "标尺长度计算:";            //             // LabelRulerStyleDialog            //             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);            this.ClientSize = new System.Drawing.Size(533, 337);            this.Controls.Add(this.groupBox3);            this.Controls.Add(this.groupBox2);            this.Controls.Add(this.groupBox1);            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;            this.MaximizeBox = false;            this.MinimizeBox = false;            this.Name = "LabelRulerStyleDialog";            this.Text = "标尺设置";            this.Controls.SetChildIndex(this.groupBox1, 0);            this.Controls.SetChildIndex(this.groupBox2, 0);            this.Controls.SetChildIndex(this.groupBox3, 0);            this.groupBox1.ResumeLayout(false);            this.groupBox2.ResumeLayout(false);            this.groupBox2.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).EndInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).EndInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();            this.groupBox3.ResumeLayout(false);            this.groupBox3.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();            this.ResumeLayout(false);        }        /// <summary>        /// 初始化控件绑定        /// </summary>        private void InitializeData()        {            //绑定字体下拉            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();            ArrayList fontsItems = new ArrayList();            foreach (FontFamily fontFamily in fonts.Families)            {                fontsItems.Add(fontFamily.Name);            }            this.comboBox1.DataSource = fontsItems;            //绑定字体位置下拉            this.comboBox2.DataSource = textPosition;            this.colorsFormFont = new ColorsForm();            this.colorsFormFont.StartPosition = FormStartPosition.CenterScreen;            this.colorsFormFont.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);            this.colorsFormLine = new ColorsForm();            this.colorsFormLine.StartPosition = FormStartPosition.CenterScreen;            this.colorsFormLine.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);            this.colorsFormBackground = new ColorsForm();            this.colorsFormBackground.StartPosition = FormStartPosition.CenterScreen;            this.colorsFormBackground.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);            this.colorsFormBorder = new ColorsForm();            this.colorsFormBorder.StartPosition = FormStartPosition.CenterScreen;            this.colorsFormBorder.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);            if(this.drawObject.drawToolType == DrawToolType.DrawHandModeRuler || this.drawObject.drawToolType == DrawToolType.DrawPrestoredRuler)            {                this.groupBox3.Visible = false;            }            this.textBold.DataSource = new string[] { PdnResources.GetString("Menu.no.text"), PdnResources.GetString("Menu.Yes.text") };        }        /// <summary>        /// 初始化标尺样式信息        /// </summary>        private void InitializeRulerModel()        {            this.rulerModel = (RulerModel)this.parentStyleModel;            this.numericUpDown3.Value = this.rulerModel.textFontSize;//文字字号            this.comboBox1.Text = this.rulerModel.textFont;//文字字体            this.panel1.BackColor = Color.FromArgb(this.rulerModel.textColor);//文字颜色            this.comboBox2.SelectedIndex = this.rulerModel.textPosition;//文字位置            this.panel3.BackColor = Color.FromArgb(this.rulerModel.lineColor);//线条颜色            this.numericUpDown4.Value = this.rulerModel.lineWidth;//线条宽度            this.numericUpDown5.Value = this.rulerModel.verticalLineLength;//垂线长度            this.numericUpDown6.Value = this.rulerModel.textHeight;//文字高度            this.panel5.BackColor = Color.FromArgb(this.rulerModel.backColor);//背景颜色            this.numericUpDown7.Value = this.rulerModel.backgroundSize;//背景大小            this.panel6.BackColor = Color.FromArgb(this.rulerModel.borderColor);//边框颜色            this.numericUpDown8.Value = this.rulerModel.borderWidth;//边框线宽            this.textBold.SelectedIndex = this.rulerModel.textBold;//字体加粗            this.numericUpDown1.Value = this.rulerModel.autoRulerValue;//自动标尺长度计算        }        /// <summary>        /// 调色板回调函数        /// </summary>        /// <param name="sender"></param>        /// <param name="ce"></param>        private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)        {        }        /// <summary>        /// 取消按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button2_Click(object sender, EventArgs e)        {            this.Close();        }        /// <summary>        /// 应用按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button1_Click(object sender, EventArgs e)        {            //如果文字字号的值为空            UpDownBase textFontUpDown = (UpDownBase)this.numericUpDown3;            if (string.IsNullOrEmpty(textFontUpDown.Text))            {                this.numericUpDown3.Value = 15;            }            //如果线条宽度的值为空            UpDownBase lineWidthUpDown = (UpDownBase)this.numericUpDown4;            if (string.IsNullOrEmpty(lineWidthUpDown.Text))            {                this.numericUpDown4.Value = 4;            }            //如果垂线长度的值为空            UpDownBase verticalLineLengthUpDown = (UpDownBase)this.numericUpDown5;            if (string.IsNullOrEmpty(verticalLineLengthUpDown.Text))            {                this.numericUpDown5.Value = 11;            }            //如果文字高度的值为空            UpDownBase fontHeightUpDown = (UpDownBase)this.numericUpDown6;            if (string.IsNullOrEmpty(fontHeightUpDown.Text))            {                this.numericUpDown6.Value = 4;            }            //如果背景大小的值为空            UpDownBase backgroundSizeUpDown = (UpDownBase)this.numericUpDown7;            if (string.IsNullOrEmpty(backgroundSizeUpDown.Text))            {                this.numericUpDown7.Value = 10;            }            //如果边框线宽的值为空            UpDownBase borderLineWidthUpDown = (UpDownBase)this.numericUpDown8;            if (string.IsNullOrEmpty(borderLineWidthUpDown.Text))            {                this.numericUpDown8.Value = 6;            }            //如果标尺长度的值为空            UpDownBase rulerValueUpDown = (UpDownBase)this.numericUpDown1;            if (string.IsNullOrEmpty(rulerValueUpDown.Text))            {                this.numericUpDown1.Value = 4000;            }            rulerModel = new RulerModel();            rulerModel.textFontSize = this.numericUpDown3.Value;//文字字号            rulerModel.textFont = this.comboBox1.Text;//文字字体            rulerModel.textColor = Convert.ToInt32(this.panel1.BackColor.ToArgb());//文字颜色            rulerModel.textPosition = this.comboBox2.SelectedIndex;//文字位置            rulerModel.textBold = this.textBold.SelectedIndex;//文字加粗            rulerModel.lineColor = Convert.ToInt32(this.panel3.BackColor.ToArgb());//线条颜色            rulerModel.lineWidth = this.numericUpDown4.Value;//线条宽度            rulerModel.verticalLineLength = this.numericUpDown5.Value;//垂线长度            rulerModel.textHeight = this.numericUpDown6.Value;//文字高度            rulerModel.backColor = Convert.ToInt32(this.panel5.BackColor.ToArgb());//背景颜色            rulerModel.backgroundSize = this.numericUpDown7.Value;//背景大小            rulerModel.borderColor = Convert.ToInt32(this.panel6.BackColor.ToArgb());//边框颜色            rulerModel.borderWidth = this.numericUpDown8.Value;//边框线宽            rulerModel.autoRulerValue = this.numericUpDown1.Value;//自动标尺长度计算            //自动标尺            if(this.drawObject.drawToolType == DrawToolType.DrawAutoRuler)            {                DrawAutoRuler drawAutoRuler = (DrawAutoRuler)this.drawObject;                drawAutoRuler.rulerModel = this.rulerModel;            }            //预存标尺            if (this.drawObject.drawToolType == DrawToolType.DrawPrestoredRuler)            {                DrawPrestoredRuler drawPrestoredRuler = (DrawPrestoredRuler)this.drawObject;                drawPrestoredRuler.rulerModel = this.rulerModel;            }            //手动标尺            if (this.drawObject.drawToolType == DrawToolType.DrawHandModeRuler)            {                DrawHandModeRuler drawHandModeRuler = (DrawHandModeRuler)this.drawObject;                drawHandModeRuler.rulerModel = this.rulerModel;            }            this.appWorkspace.ActiveDocumentWorkspace.Refresh();            this.Close();        }        /// <summary>        /// 文字颜色被点击        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void panel1_Click(object sender, EventArgs e)        {            this.colorsFormFont.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);            this.colorsFormFont.setSaveBtn_Click(new System.EventHandler(this.colorsFormFontChanged));            this.colorsFormFont.ShowDialog();        }        /// <summary>        /// 文字颜色调色板        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void colorsFormFontChanged(object sender, EventArgs e)        {            this.panel1.BackColor = this.colorsFormFont.UserPrimaryColor.ToColor();            this.colorsFormFont.Close();        }        /// <summary>        /// 线条颜色被点击        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void panel3_Click(object sender, EventArgs e)        {            this.colorsFormLine.UserPrimaryColor = ColorBgra.FromColor(this.panel3.BackColor);            this.colorsFormLine.setSaveBtn_Click(new System.EventHandler(this.colorsFormLineChanged));            this.colorsFormLine.ShowDialog();        }        /// <summary>        /// 线条颜色调色板        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void colorsFormLineChanged(object sender, EventArgs e)        {            this.panel3.BackColor = this.colorsFormLine.UserPrimaryColor.ToColor();            this.colorsFormLine.Close();        }        /// <summary>        /// 背景颜色被点击        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void panel5_Click(object sender, EventArgs e)        {            this.colorsFormBackground.UserPrimaryColor = ColorBgra.FromColor(this.panel5.BackColor);            this.colorsFormBackground.setSaveBtn_Click(new System.EventHandler(this.colorsFormBackgroundChanged));            this.colorsFormBackground.ShowDialog();        }        /// <summary>        /// 背景颜色调色板        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void colorsFormBackgroundChanged(object sender, EventArgs e)        {            this.panel5.BackColor = this.colorsFormBackground.UserPrimaryColor.ToColor();            this.colorsFormBackground.Close();        }        /// <summary>        /// 边框颜色被点击        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void panel6_Click(object sender, EventArgs e)        {            this.colorsFormBorder.UserPrimaryColor = ColorBgra.FromColor(this.panel6.BackColor);            this.colorsFormBorder.setSaveBtn_Click(new System.EventHandler(this.colorsFormBorderChanged));            this.colorsFormBorder.ShowDialog();        }        /// <summary>        /// 边框颜色调色板        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void colorsFormBorderChanged(object sender, EventArgs e)        {            this.panel6.BackColor = this.colorsFormBorder.UserPrimaryColor.ToColor();            this.colorsFormBorder.Close();        }    }}
 |