using PaintDotNet.Annotation.Enum; using PaintDotNet.Annotation.relationModel; using PaintDotNet.Base.SettingModel; using PaintDotNet.Base.CommTool; using PaintDotNet.Setting.LabelComponent; using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Windows.Forms; using PaintDotNet.Base; using PaintDotNet.Annotation; namespace PaintDotNet.Setting { /// /// 设置->标注设置 /// internal class LabelSettingDialog : PdnBaseForm { /// /// 标注一二级关系 /// private static List list; /// /// 当前选中的二级标注 /// private DrawToolType drawToolType; /// /// 标注的样式 /// private LabelStyleModel labelStyleModel = Startup.instance.labelStyleModel; /// /// 主配置文件的model /// private ConfigModel configModel = Startup.instance.configModel; /// /// 操作样式下拉数据 /// private List files = new List(); /// /// 另存为弹出框显示 /// private CreateNameDialog dialog; /// /// 另存为文件名 /// private string newName; private int initflag = 0; //各页面组件 private LabelTextControl textControl; private LabelMarkDateControl dateMarkControl; private LabelMarkTimeControl timeMarkControl; private LabelMarkPointControl pointMarkControl; private LabelMarkNumberControl numberMarkControl; private LabelMarkGainNumberControl gainNumberControl; private LabelStraightLineControl straightLineControl; private LabelStraightLineSegmentControl segmentLineControl; private LabelCurvePencilControl pencilControl; private LabelCurvePolylineControl polylineControl; private LabelCurveControl curveControl; private LabelCurveClosedControl closedCurveControl; private LabelArrowOneWayControl oneWayArrowControl; private LabelArrowTwoWayControl twoWayArrowControl; private LabelCircleControl circleControl; private LabelCircleOvalControl ovalControl; private LabelPolygonRectangleControl polygonRectangleControl; private LabelPolygonControl polygonControl; private LabelPolygonRoundedControl roundedRectangleControl; private GroupBox groupBox4; private System.Windows.Forms.Label label71; private NumericUpDown numericUpDown71; private ConfigModel config = Startup.instance.configModel; private AppWorkspace appWorkspace; PaintDotNet.ColorsForm colorsForm2; PaintDotNet.ColorsForm colorsForm3; PaintDotNet.ColorsForm colorsForm4; PaintDotNet.ColorsForm colorsForm5; #region 控件 private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.ListBox listBox1; private Button button3; private Button button2; private Button button4; private ComboBox comboBox1; private Label label1; private CheckBox checkbox1; private Panel panel5; private Panel panel4; private NumericUpDown numericUpDown2; private ComboBox comboBox9; private Label label19; private Label label17; private Label label16; private Label label15; private Button button5; #endregion public LabelSettingDialog(AppWorkspace appWorkspace) { if (list == null) { list = InvariantData.GetLabelRelations(); } this.appWorkspace = appWorkspace; InitializeComponent(); InitializeLanguageText(); InitializeData(); } private void InitializeLanguageText() { this.label1.Text = PdnResources.GetString("Menu.Currentoperationstyle.text") + ":"; this.button4.Text = PdnResources.GetString("Menu.Edit.Delete.Text"); this.button3.Text = PdnResources.GetString("Menu.File.SaveAs.Text"); this.button2.Text = PdnResources.GetString("Menu.File.Save.Text"); this.groupBox2.Text = PdnResources.GetString("Menu.Setting.Text"); this.groupBox4.Text = PdnResources.GetString("Menu.Setting.Text"); this.groupBox3.Text = PdnResources.GetString("Menu.Type.text"); this.button5.Text = PdnResources.GetString("Menu.File.SaveAll.Text"); this.Text = PdnResources.GetString("Menu.Setting.LabelSetting.Text"); this.label71.Text = PdnResources.GetString("Markpointsize.Text") + ":"; } private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.button4 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.listBox1 = new System.Windows.Forms.ListBox(); this.panel1 = new System.Windows.Forms.Panel(); this.button5 = new System.Windows.Forms.Button(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.checkbox1 = new System.Windows.Forms.CheckBox(); this.panel5 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel(); this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); this.comboBox9 = new System.Windows.Forms.ComboBox(); this.label19 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.label71 = new System.Windows.Forms.Label(); this.numericUpDown71 = new System.Windows.Forms.NumericUpDown(); this.groupBox1.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown71)).BeginInit(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.comboBox1); this.groupBox1.Controls.Add(this.button4); this.groupBox1.Controls.Add(this.button3); this.groupBox1.Controls.Add(this.button2); this.groupBox1.Location = new System.Drawing.Point(134, 13); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(638, 58); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(176, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(89, 12); this.label1.TabIndex = 5; this.label1.Text = "当前操作样式:"; // // comboBox1 // this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.FormattingEnabled = true; this.comboBox1.Location = new System.Drawing.Point(271, 21); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(116, 20); this.comboBox1.TabIndex = 4; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // button4 // this.button4.Location = new System.Drawing.Point(393, 20); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(75, 23); this.button4.TabIndex = 3; this.button4.Text = "删除"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click); // // button3 // this.button3.Location = new System.Drawing.Point(474, 20); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 2; this.button3.Text = "另存为"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // // button2 // this.button2.Location = new System.Drawing.Point(555, 20); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 1; this.button2.Text = "保存"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // groupBox2 // this.groupBox2.Location = new System.Drawing.Point(137, 114); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(633, 235); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = "设置"; // // groupBox3 // this.groupBox3.Controls.Add(this.listBox1); this.groupBox3.Location = new System.Drawing.Point(13, 13); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(115, 340); this.groupBox3.TabIndex = 3; this.groupBox3.TabStop = false; this.groupBox3.Text = "类型"; // // listBox1 // this.listBox1.FormattingEnabled = true; this.listBox1.ItemHeight = 12; this.listBox1.Location = new System.Drawing.Point(6, 20); this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(103, 316); this.listBox1.TabIndex = 0; this.listBox1.SelectedValueChanged += new System.EventHandler(this.listBox1_SelectedValueChanged); // // panel1 // this.panel1.Location = new System.Drawing.Point(134, 78); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(556, 36); this.panel1.TabIndex = 5; // // button5 // this.button5.Location = new System.Drawing.Point(692, 78); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(75, 23); this.button5.TabIndex = 4; this.button5.Text = "保存全部"; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); // // groupBox4 // this.groupBox4.Controls.Add(this.checkbox1); this.groupBox4.Controls.Add(this.panel5); this.groupBox4.Controls.Add(this.panel4); this.groupBox4.Controls.Add(this.numericUpDown2); this.groupBox4.Controls.Add(this.comboBox9); this.groupBox4.Controls.Add(this.label19); this.groupBox4.Controls.Add(this.label17); this.groupBox4.Controls.Add(this.label16); this.groupBox4.Controls.Add(this.label15); this.groupBox4.Controls.Add(this.label71); this.groupBox4.Controls.Add(this.numericUpDown71); this.groupBox4.Location = new System.Drawing.Point(137, 76); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(716, 277); this.groupBox4.TabIndex = 6; this.groupBox4.TabStop = false; this.groupBox4.Text = "设置"; this.groupBox4.Visible = false; // // checkbox1 // this.checkbox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.checkbox1.AutoSize = true; this.checkbox1.Location = new System.Drawing.Point(136, 238); this.checkbox1.Name = "checkbox1"; this.checkbox1.Size = new System.Drawing.Size(78, 16); this.checkbox1.TabIndex = 42; this.checkbox1.Text = "跟随缩放 "; this.checkbox1.UseVisualStyleBackColor = true; // // panel5 // this.panel5.BackColor = System.Drawing.SystemColors.Window; this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel5.Location = new System.Drawing.Point(137, 106); this.panel5.Name = "panel5"; this.panel5.Size = new System.Drawing.Size(152, 20); this.panel5.TabIndex = 41; this.panel5.Click += new EventHandler(panel5Click); // // panel4 // this.panel4.BackColor = System.Drawing.SystemColors.Window; this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel4.Location = new System.Drawing.Point(137, 192); this.panel4.Name = "panel4"; this.panel4.Size = new System.Drawing.Size(152, 20); this.panel4.TabIndex = 40; this.panel4.Click += new EventHandler(panel4Click); // // numericUpDown2 // this.numericUpDown2.Location = new System.Drawing.Point(137, 147); this.numericUpDown2.Maximum = new decimal(new int[] { 100000, 0, 0, 0}); this.numericUpDown2.Name = "numericUpDown2"; this.numericUpDown2.Size = new System.Drawing.Size(152, 21); this.numericUpDown2.TabIndex = 39; // // comboBox9 // this.comboBox9.FormattingEnabled = true; this.comboBox9.Location = new System.Drawing.Point(137, 60); this.comboBox9.Name = "comboBox9"; this.comboBox9.Size = new System.Drawing.Size(150, 20); this.comboBox9.TabIndex = 38; // // label19 // this.label19.AutoSize = true; this.label19.Location = new System.Drawing.Point(64, 196); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(65, 12); this.label19.TabIndex = 37; this.label19.Text = "填充颜色:"; // // label17 // this.label17.AutoSize = true; this.label17.Location = new System.Drawing.Point(64, 151); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(65, 12); this.label17.TabIndex = 36; this.label17.Text = "线条宽度:"; // // label16 // this.label16.AutoSize = true; this.label16.Location = new System.Drawing.Point(66, 110); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(65, 12); this.label16.TabIndex = 35; this.label16.Text = "线条颜色:"; // // label15 // this.label15.AutoSize = true; this.label15.Location = new System.Drawing.Point(54, 64); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(77, 12); this.label15.TabIndex = 34; this.label15.Text = "标记点样式:"; // // label71 // this.label71.Location = new System.Drawing.Point(6, 27); this.label71.Name = "label71"; this.label71.Size = new System.Drawing.Size(125, 13); this.label71.TabIndex = 0; this.label71.Text = "标记点大小:"; this.label71.TextAlign = System.Drawing.ContentAlignment.TopRight; // // numericUpDown71 // this.numericUpDown71.Location = new System.Drawing.Point(134, 23); this.numericUpDown71.Maximum = new decimal(new int[] { 100000, 0, 0, 0}); this.numericUpDown71.Name = "numericUpDown71"; this.numericUpDown71.Size = new System.Drawing.Size(152, 21); this.numericUpDown71.TabIndex = 14; // // LabelSettingDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(776, 359); this.Controls.Add(this.button5); this.Controls.Add(this.panel1); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox2); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "LabelSettingDialog"; this.Text = "标注设置"; this.Controls.SetChildIndex(this.groupBox2, 0); this.Controls.SetChildIndex(this.groupBox4, 0); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.groupBox3, 0); this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.button5, 0); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown71)).EndInit(); this.ResumeLayout(false); } /// /// 初始化数据 /// private void InitializeData() { this.colorsForm2 = new ColorsForm(); this.colorsForm2.StartPosition = FormStartPosition.CenterScreen; this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged); this.colorsForm3 = new ColorsForm(); this.colorsForm3.StartPosition = FormStartPosition.CenterScreen; this.colorsForm3.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged); this.colorsForm4 = new ColorsForm(); this.colorsForm4.StartPosition = FormStartPosition.CenterScreen; this.colorsForm4.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged); this.colorsForm5 = new ColorsForm(); this.colorsForm5.StartPosition = FormStartPosition.CenterScreen; this.colorsForm5.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged); //绑定左侧listbox数据 this.listBox1.Items.Clear(); foreach (LabelRelationModel model in list) { this.listBox1.Items.Add(model.name); } this.listBox1.SelectedIndex = 0; //绑定样式下拉 if (initflag++ == 0) { InitializeStyleName(); } //更新右侧设置界面 UpdateRightSettingUI(); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion #region [标记点相关] this.comboBox9.Items.Add("正方形"); this.comboBox9.Items.Add("圆形"); this.comboBox9.Items.Add("三角形"); this.numericUpDown71.Value = this.config.MarkpointWidth; this.comboBox9.SelectedIndex = this.config.MarkpointStyle; this.panel5.BackColor = Color.FromArgb(this.config.MarkpointLineColor); this.numericUpDown2.Value = this.config.MarkpointLineWidth; this.panel4.BackColor = Color.FromArgb(this.config.MarkpointAreaColor); this.checkbox1.Checked = this.config.isFollow; #endregion } /// /// 初始化样式下拉 /// private void InitializeStyleName() { List fileNames = FileOperationHelper.GetFileList(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\"); files.Clear(); foreach (string fileName in fileNames) { string name = fileName.Substring(0, fileName.LastIndexOf(".")); files.Add(name); } this.comboBox1.SelectedIndexChanged -= this.comboBox1_SelectedIndexChanged; this.comboBox1.DataSource = null; this.comboBox1.DataSource = files; string nowModelName = Startup.instance.configModel.Watermark.Substring(0, Startup.instance.configModel.Watermark.LastIndexOf(".")); this.comboBox1.SelectedIndex = files.FindIndex(a => a.Equals(nowModelName)); this.labelStyleModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open)); this.comboBox1.SelectedIndexChanged += new EventHandler(this.comboBox1_SelectedIndexChanged); } /// /// 当前操作样式 下拉选切换 /// /// /// private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { this.labelStyleModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open)); InitializeData(); } /// /// 左侧listbox选择事件 /// /// /// private void listBox1_SelectedValueChanged(object sender, EventArgs e) { //首先更新右侧分类部分 UpdateRightCatalog(); //更新右侧设置界面 UpdateRightSettingUI(); //刷新右侧预览 UpdateRightPreview(); } /// /// 更新右侧分类 /// private void UpdateRightCatalog() { this.panel1.Controls.Clear(); LabelRelationModel model = list[this.listBox1.SelectedIndex]; int postion = 0; if (model.id == 8) { groupBox2.Visible = false; panel1.Visible = false; button5.Visible = false; groupBox4.Visible = true; comboBox1.Visible = false; button4.Visible = false; button3.Visible = false; label1.Visible = false; } else { groupBox2.Visible = true; panel1.Visible = true; button5.Visible = true; groupBox4.Visible = false; comboBox1.Visible = true; button4.Visible = true; button3.Visible = true; label1.Visible = true; } foreach (LabelRelationModel.ChildLabel child in model.childLabel) { Button button = new Button(); button.Size = new Size(75, 23); button.Location = new Point(postion * 75 + 5, 0); button.Text = child.name; button.Tag = child; button.Click += new EventHandler(ChildButton_Click); this.panel1.Controls.Add(button); if (postion == 0) { this.drawToolType = child.drawToolType; button.Focus(); } postion++; } } /// /// 二级分类按钮点击事件 /// /// /// private void ChildButton_Click(object sender, EventArgs e) { Button button = (Button)sender; LabelRelationModel.ChildLabel child = (LabelRelationModel.ChildLabel)button.Tag; this.drawToolType = child.drawToolType; this.UpdateRightSettingUI(); } /// /// 更新右侧设置 /// private void UpdateRightSettingUI() { this.groupBox2.Controls.Clear(); switch (this.drawToolType) { case DrawToolType.DrawTextString: //文本 textControl = new LabelTextControl(this.labelStyleModel.text); textControl.Location = new Point(10, 15); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion this.groupBox2.Controls.Add(textControl); break; case DrawToolType.DrawDateMark: //标记-日期 dateMarkControl = new LabelMarkDateControl(this.labelStyleModel.dateMark); dateMarkControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(dateMarkControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.dateMark.chooseStyle == null ? "" : this.labelStyleModel.dateMark.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.dateMark.chooseStyle == null ? 1 : this.labelStyleModel.dateMark.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.dateMark.chooseStyle == null ? 1 : this.labelStyleModel.dateMark.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.dateMark.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.dateMark.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.dateMark.chooseStyle == null ? 0 : this.labelStyleModel.dateMark.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.dateMark.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.dateMark.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.dateMark.chooseStyle == null ? 0 : this.labelStyleModel.dateMark.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawTimeMark: //标记-时间 timeMarkControl = new LabelMarkTimeControl(this.labelStyleModel.timeMark); timeMarkControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(timeMarkControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.timeMark.chooseStyle == null ? "" : this.labelStyleModel.tetimeMarkxt.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.timeMark.chooseStyle == null ? 1 : this.labelStyleModel.timeMark.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.timeMark.chooseStyle == null ? 1 : this.labelStyleModel.timeMark.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.timeMark.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.timeMark.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.timeMark.chooseStyle == null ? 0 : this.labelStyleModel.timeMark.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.timeMark.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.timeMark.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.timeMark.chooseStyle == null ? 0 : this.labelStyleModel.timeMark.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawPointMark: //标记-点标记 pointMarkControl = new LabelMarkPointControl(this.labelStyleModel.pointMark); pointMarkControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(pointMarkControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawNumberMark: //标记-数字标记 numberMarkControl = new LabelMarkNumberControl(this.labelStyleModel.numberMark); numberMarkControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(numberMarkControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawGainNumber: //标记-放大倍数 gainNumberControl = new LabelMarkGainNumberControl(this.labelStyleModel.gainNumber); gainNumberControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(gainNumberControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawLine: //直线->直线 straightLineControl = new LabelStraightLineControl(this.labelStyleModel.lineChildLine); straightLineControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(straightLineControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawLineSegment: //直线->线段 segmentLineControl = new LabelStraightLineSegmentControl(this.labelStyleModel.lineChildLineSegment); segmentLineControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(segmentLineControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawPencil: //曲线->铅笔 pencilControl = new LabelCurvePencilControl(this.labelStyleModel.pencilModel); pencilControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(pencilControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawPolygonLine: //曲线->折线 polylineControl = new LabelCurvePolylineControl(this.labelStyleModel.polylineModel); polylineControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(polylineControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawCurve: //曲线->曲线 curveControl = new LabelCurveControl(this.labelStyleModel.curveModel); curveControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(curveControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawClosedCurve: //曲线->闭合曲线 closedCurveControl = new LabelCurveClosedControl(this.labelStyleModel.closedCurveModel); closedCurveControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(closedCurveControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawOneArrowLine: //箭头->单向箭头 oneWayArrowControl = new LabelArrowOneWayControl(this.labelStyleModel.oneWayArrowModel); oneWayArrowControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(oneWayArrowControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawTwoArrowLine: //箭头->双向箭头 twoWayArrowControl = new LabelArrowTwoWayControl(this.labelStyleModel.twoWayArrowModel); twoWayArrowControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(twoWayArrowControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawCircle: //圆->圆 circleControl = new LabelCircleControl(this.labelStyleModel.circleModel); circleControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(circleControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawEllipse: //圆->椭圆 ovalControl = new LabelCircleOvalControl(this.labelStyleModel.ovalModel); ovalControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(ovalControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawRectangle: //多边形->矩形 polygonRectangleControl = new LabelPolygonRectangleControl(this.labelStyleModel.polygonRectangle); polygonRectangleControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(polygonRectangleControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawPolygon: //多边形->多边形 polygonControl = new LabelPolygonControl(this.labelStyleModel.polygonPolygon); polygonControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(polygonControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; case DrawToolType.DrawRoundRectangle: //多边形->圆角矩形 roundedRectangleControl = new LabelPolygonRoundedControl(this.labelStyleModel.roundedRectangle); roundedRectangleControl.Location = new Point(10, 15); this.groupBox2.Controls.Add(roundedRectangleControl); #region [选中样式] //this.comboBox20.Text = this.labelStyleModel.text.chooseStyle == null ? "" : this.labelStyleModel.text.chooseStyle.font; //this.numericUpDown4.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.lineWidth; //this.numericUpDown5.Value = this.labelStyleModel.text.chooseStyle == null ? 1 : this.labelStyleModel.text.chooseStyle.fontSize; //this.panel9.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.textColor); //this.numericUpDown3.Value = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.vLineLength; //this.panel8.BackColor = this.labelStyleModel.text.chooseStyle == null ? Color.Black : Color.FromArgb(this.labelStyleModel.text.chooseStyle.lineColor); //this.comboBox18.SelectedIndex = this.labelStyleModel.text.chooseStyle == null ? 0 : this.labelStyleModel.text.chooseStyle.lineStyle; #endregion break; } } /// /// 刷新右侧预览图 /// private void UpdateRightPreview() { } /// /// 删除 /// /// /// private void button4_Click(object sender, EventArgs e) { if ("Default".Equals(this.comboBox1.Text)) { MessageBox.Show(PdnResources.GetString("Menu.efaultstylecannotbedelete.Text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.nfirmthedeleti.Text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); if (dr == DialogResult.OK) { int newIndex = 0; int selectIndex = this.comboBox1.SelectedIndex; int tall = files.Count - 1; if (selectIndex < tall) { newIndex = selectIndex; } string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.Text + ".xml"; FileInfo fileInfo = new FileInfo(filePath); fileInfo.Delete(); InitializeStyleName(); this.comboBox1.SelectedIndex = newIndex; this.labelStyleModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open)); InitializeData(); } else if (dr == DialogResult.Cancel) { } } /// /// 另存为 出弹窗 /// /// /// 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(); } /// /// 另存为弹窗 确定保存 /// /// public override void GetCreateName(string name) { string currentcomboBox = this.comboBox1.Text; this.newName = name; if (files.Contains(this.newName)) { MessageBox.Show(PdnResources.GetString("Menu.Stylenamecannotberepeated.text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } LabelStyleModel newModel = this.labelStyleModel; modelSave(newModel); //另存为 string stageModelXml = XmlSerializeHelper.XmlSerialize(newModel); string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.newName + ".xml"; FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create); InitializeStyleName(); this.comboBox1.Text = currentcomboBox; dialog.Close(); } /// /// 保存 /// /// /// private void button2_Click(object sender, EventArgs e) { this.labelStyleModel = modelSave(this.labelStyleModel); //以下保存xml文件信息 string stageModelXml = XmlSerializeHelper.XmlSerialize(this.labelStyleModel); string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.Text + ".xml"; FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create); this.config.MarkpointWidth = Convert.ToInt32(this.numericUpDown71.Value); this.config.MarkpointStyle = this.comboBox9.SelectedIndex; this.config.MarkpointLineColor = this.panel5.BackColor.ToArgb(); this.config.MarkpointLineWidth = Convert.ToInt32(this.numericUpDown2.Value); this.config.MarkpointAreaColor = this.panel4.BackColor.ToArgb(); this.config.isFollow = this.checkbox1.Checked; string configModelXml = XmlSerializeHelper.XmlSerialize(config); FileOperationHelper.WriteStringToFile(configModelXml, Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Config.xml", FileMode.Create); MarkPointRect.markPointRectWidth = configModel.MarkpointWidth; //if (this.appWorkspace.DocumentWorkspaces != null) //{ // foreach (var item in this.appWorkspace.DocumentWorkspaces) // { // if (item != null && item.GraphicsList != null) // foreach (var graObject in item.GraphicsList.graphicsList) // { // graObject.smallRectangleWidth = this.config.MarkpointWidth; // } // item.Refresh(); // } //} DrawObject.smallRectangleWidth = this.config.MarkpointWidth; DrawObject.MarkpointStyle = this.config.MarkpointStyle; DrawObject.MarkpointLineColor = this.config.MarkpointLineColor; DrawObject.MarkpointLineWidth = this.config.MarkpointLineWidth; DrawObject.MarkpointAreaColor = this.config.MarkpointAreaColor; DrawObject.isFollow = this.checkbox1.Checked; ApplicationSetting(); } /// /// 各个子页面的model保存方法 /// private LabelStyleModel modelSave(LabelStyleModel model) { switch (this.drawToolType) { case DrawToolType.DrawTextString: //文本 model.text = textControl.getNowModel(this.labelStyleModel.text); break; case DrawToolType.DrawDateMark: //标记-日期 model.dateMark = dateMarkControl.getNowModel(this.labelStyleModel.dateMark); break; case DrawToolType.DrawTimeMark: //标记-时间 model.timeMark = timeMarkControl.getNowModel(this.labelStyleModel.timeMark); break; case DrawToolType.DrawPointMark: //标记-点标记 model.pointMark = pointMarkControl.getNowModel(this.labelStyleModel.pointMark); break; case DrawToolType.DrawNumberMark: //标记-数字标记 model.numberMark = numberMarkControl.getNowModel(this.labelStyleModel.numberMark); break; case DrawToolType.DrawGainNumber: //标记-放大倍数 model.gainNumber = gainNumberControl.getNowModel(this.labelStyleModel.gainNumber); break; case DrawToolType.DrawLine: //直线->直线 model.lineChildLine = straightLineControl.getNowModel(this.labelStyleModel.lineChildLine); break; case DrawToolType.DrawLineSegment: //直线->线段 model.lineChildLineSegment = segmentLineControl.getNowModel(this.labelStyleModel.lineChildLineSegment); break; case DrawToolType.DrawPencil: //曲线->铅笔 model.pencilModel = pencilControl.getNowModel(this.labelStyleModel.pencilModel); break; case DrawToolType.DrawPolygonLine: //曲线->折线 model.polylineModel = polylineControl.getNowModel(this.labelStyleModel.polylineModel); break; case DrawToolType.DrawCurve: //曲线->曲线 model.curveModel = curveControl.getNowModel(this.labelStyleModel.curveModel); break; case DrawToolType.DrawClosedCurve: //曲线->闭合曲线 model.closedCurveModel = closedCurveControl.getNowModel(this.labelStyleModel.closedCurveModel); break; case DrawToolType.DrawOneArrowLine: //箭头->单向箭头 model.oneWayArrowModel = oneWayArrowControl.getNowModel(this.labelStyleModel.oneWayArrowModel); break; case DrawToolType.DrawTwoArrowLine: //箭头->双向箭头 model.twoWayArrowModel = twoWayArrowControl.getNowModel(this.labelStyleModel.twoWayArrowModel); break; case DrawToolType.DrawCircle: //圆->圆 model.circleModel = circleControl.getNowModel(this.labelStyleModel.circleModel); break; case DrawToolType.DrawEllipse: //圆->椭圆 model.ovalModel = ovalControl.getNowModel(this.labelStyleModel.ovalModel); break; case DrawToolType.DrawRectangle: //多边形->矩形 model.polygonRectangle = polygonRectangleControl.getNowModel(this.labelStyleModel.polygonRectangle); break; case DrawToolType.DrawPolygon: //多边形->多边形 model.polygonPolygon = polygonControl.getNowModel(this.labelStyleModel.polygonPolygon); break; case DrawToolType.DrawRoundRectangle: //多边形->圆角矩形 model.roundedRectangle = roundedRectangleControl.getNowModel(this.labelStyleModel.roundedRectangle); break; } return model; } /// /// 应用 /// /// /// private void ApplicationSetting() { //修改缓存中的样式数据 Startup.instance.labelStyleModel = this.labelStyleModel; //修改主配置文件中的值 configModel.LabelStyle = this.comboBox1.Text + ".xml"; //修改主配置文件的xml string configModelXml = XmlSerializeHelper.XmlSerialize(this.configModel); string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Config.xml"; FileOperationHelper.WriteStringToFile(configModelXml, filePath, FileMode.Create); MessageBox.Show(PdnResources.GetString("Menu.Successfullysaved.text")); } /// /// 应用全部 /// /// /// private void button5_Click(object sender, EventArgs e) { switch (this.drawToolType) { case DrawToolType.DrawTextString: //文本 this.labelStyleModel.text = textControl.getNowModel(this.labelStyleModel.text); break; case DrawToolType.DrawDateMark: //标记-日期 this.labelStyleModel = dateMarkControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawTimeMark: //标记-时间 this.labelStyleModel = timeMarkControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawNumberMark: //标记-数字标记 this.labelStyleModel = numberMarkControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawGainNumber: //标记-放大倍数 this.labelStyleModel = gainNumberControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawLine: //直线->直线 this.labelStyleModel = straightLineControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawLineSegment: //直线->线段 this.labelStyleModel = segmentLineControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawPencil: //曲线->铅笔 this.labelStyleModel = pencilControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawPolygonLine: //曲线->折线 this.labelStyleModel = polylineControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawCurve: //曲线->曲线 this.labelStyleModel = curveControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawClosedCurve: //曲线->闭合曲线 this.labelStyleModel = closedCurveControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawOneArrowLine: //箭头->单向箭头 this.labelStyleModel = oneWayArrowControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawTwoArrowLine: //箭头->双向箭头 this.labelStyleModel = twoWayArrowControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawCircle: //圆->圆 this.labelStyleModel = circleControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawEllipse: //圆->椭圆 this.labelStyleModel = ovalControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawRectangle: //多边形->矩形 this.labelStyleModel = polygonRectangleControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawPolygon: //多边形->多边形 this.labelStyleModel = polygonControl.ApplyAll(this.labelStyleModel); break; case DrawToolType.DrawRoundRectangle: //多边形->圆角矩形 this.labelStyleModel = roundedRectangleControl.ApplyAll(this.labelStyleModel); break; } //以下保存xml文件信息 string stageModelXml = XmlSerializeHelper.XmlSerialize(this.labelStyleModel); string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Label\\" + this.comboBox1.Text + ".xml"; FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create); ApplicationSetting(); } private void panel5Click(object sender, EventArgs e) { this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel5.BackColor); this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.panel5Changed)); this.colorsForm2.ShowDialog(); } private void panel5Changed(object sender, EventArgs e) { this.panel5.BackColor = this.colorsForm2.UserPrimaryColor.ToColor(); this.colorsForm2.Close(); } private void panel4Click(object sender, EventArgs e) { this.colorsForm3.UserPrimaryColor = ColorBgra.FromColor(this.panel4.BackColor); this.colorsForm3.setSaveBtn_Click(new System.EventHandler(this.panel4Changed)); this.colorsForm3.ShowDialog(); } private void panel4Changed(object sender, EventArgs e) { this.panel4.BackColor = this.colorsForm3.UserPrimaryColor.ToColor(); this.colorsForm3.Close(); } private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce) { } } }