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; /// /// 字体位置下拉 /// 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)this.drawObject.GetStyle()); this.parentStyleModel = DrawRulerHelper.DeserializeXML(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); } /// /// 初始化控件绑定 /// 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") }; } /// /// 初始化标尺样式信息 /// 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;//自动标尺长度计算 } /// /// 调色板回调函数 /// /// /// private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce) { } /// /// 取消按钮 /// /// /// private void button2_Click(object sender, EventArgs e) { this.Close(); } /// /// 应用按钮 /// /// /// 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(); } /// /// 文字颜色被点击 /// /// /// 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(); } /// /// 文字颜色调色板 /// /// /// private void colorsFormFontChanged(object sender, EventArgs e) { this.panel1.BackColor = this.colorsFormFont.UserPrimaryColor.ToColor(); this.colorsFormFont.Close(); } /// /// 线条颜色被点击 /// /// /// 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(); } /// /// 线条颜色调色板 /// /// /// private void colorsFormLineChanged(object sender, EventArgs e) { this.panel3.BackColor = this.colorsFormLine.UserPrimaryColor.ToColor(); this.colorsFormLine.Close(); } /// /// 背景颜色被点击 /// /// /// 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(); } /// /// 背景颜色调色板 /// /// /// private void colorsFormBackgroundChanged(object sender, EventArgs e) { this.panel5.BackColor = this.colorsFormBackground.UserPrimaryColor.ToColor(); this.colorsFormBackground.Close(); } /// /// 边框颜色被点击 /// /// /// 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(); } /// /// 边框颜色调色板 /// /// /// private void colorsFormBorderChanged(object sender, EventArgs e) { this.panel6.BackColor = this.colorsFormBorder.UserPrimaryColor.ToColor(); this.colorsFormBorder.Close(); } } }