using PaintDotNet.Base.CommTool;
using PaintDotNet.Base.SettingModel;
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using static PaintDotNet.Base.SettingModel.RulerModel;
namespace PaintDotNet.Setting
{
internal class RulerSettingDialog : PdnBaseForm
{
#region 属性
#region 组件定义
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button cancelBtn;
private System.Windows.Forms.Button saveBtn;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox previewGroupBox;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.RadioButton rulerPositionVal2;
private System.Windows.Forms.RadioButton rulerPositionVal4;
private System.Windows.Forms.RadioButton rulerPositionVal3;
private System.Windows.Forms.RadioButton rulerPositionVal1;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Button addRulerBtn;
private System.Windows.Forms.Button deleteRulerBtn;
private System.Windows.Forms.ComboBox textFontVal;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.ComboBox textPositionVal;
private System.Windows.Forms.Panel textColorPanel;
private System.Windows.Forms.Panel lineColorPanel;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.NumericUpDown textFontSizeVal;
private System.Windows.Forms.NumericUpDown lineWidthVal;
private System.Windows.Forms.NumericUpDown verticalLineLengthVal;
private System.Windows.Forms.NumericUpDown textHeightVal;
private System.Windows.Forms.Panel backColorPanel;
private System.Windows.Forms.Panel borderColorPanel;
private System.Windows.Forms.NumericUpDown backgroundSizeVal;
private System.Windows.Forms.NumericUpDown borderWidthVal;
private System.Windows.Forms.Panel previewPanel;
private System.Windows.Forms.NumericUpDown autoRulerValueVal;
private System.Windows.Forms.NumericUpDown rulerMarginVal;
private System.Windows.Forms.Label label20;
PaintDotNet.ColorsForm colorsFormFont;
PaintDotNet.ColorsForm colorsFormLine;
PaintDotNet.ColorsForm colorsFormBackground;
PaintDotNet.ColorsForm colorsFormBorder;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel1;
private Form addRulerform = new PdnBaseForm();
private TextBox nameValue = new TextBox();
private NumericUpDown lengthVal = new NumericUpDown();
#endregion
private RulerModel rulerModel = new RulerModel();
private PresetRuler tempPresetRuler = new PresetRuler();
private ComboBox textBold;
private Label label21;
private AppWorkspace appWorkspace;
#endregion
public RulerSettingDialog(AppWorkspace appWorkspace)
{
this.appWorkspace = appWorkspace;
InitializeComponent();
InitializeLanguageText();
InitializeComponent2();
addRulerformInit();
readData();
buildListView();
}
#region 组件相关
#region Windows Form Designer generated code
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeLanguageText()
{
this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
this.cancelBtn.Text = PdnResources.GetString("Menu.cancel.text");
this.saveBtn.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.label8.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textheight.text") + ":";
this.label4.Text = PdnResources.GetString("Menu.Set.Rulersettings.Textposition.text") + ":";
this.label11.Text = PdnResources.GetString("Menu.backgroundcolor.text") + ":";
this.label10.Text = PdnResources.GetString("Menu.Set.Rulersettings.Borderlinecolor.text") + ":";
this.label3.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linecolor.text") + ":";
this.label2.Text = PdnResources.GetString("Menu.Set.Rulersettings.lengthofperpendicular.text") + ":";
this.label9.Text = PdnResources.GetString("Menu.Backgroundsize.text") + ":";
this.label7.Text = PdnResources.GetString("Menu.Set.Rulersettings.Fontsize.text") + ":";
this.label1.Text = PdnResources.GetString("Menu.Set.Rulersettings.Linewidth.text") + ":";
this.label5.Text = PdnResources.GetString("Menu.Textcolor.text") + ":";
this.label6.Text = PdnResources.GetString("Menu.Textfont.text") + ":";
this.previewGroupBox.Text = PdnResources.GetString("Menu.Preview.text");
this.groupBox4.Text = PdnResources.GetString("Menu.Set.Rulersettings.automaticannotation.text");
this.label14.Text = PdnResources.GetString("Menu.Set.Rulersettings.Dividebymagnification.text");
this.label13.Text = PdnResources.GetString("Menu.Set.Rulersettings.Calculationoflabellength.text") + ":";
this.groupBox5.Text = PdnResources.GetString("Menu.Set.Rulersettings.Rulerposition.text");
this.label16.Text = PdnResources.GetString("Menu.Set.Rulersettings.Labelmargin.text") + ":";
this.rulerPositionVal2.Text = PdnResources.GetString("Menu.Upperright.text");
this.rulerPositionVal4.Text = PdnResources.GetString("Menu.Lowerright.text");
this.rulerPositionVal3.Text = PdnResources.GetString("Menu.Lowerleft.text");
this.rulerPositionVal1.Text = PdnResources.GetString("Menu.Upperleft.text");
this.label15.Text = PdnResources.GetString("Menu.Set.Rulersettings.Rulerposition.text") + ":";
this.groupBox6.Text = PdnResources.GetString("Menu.Set.Rulersettings.Pre-storedannotation.text");
this.Text = PdnResources.GetString("Menu.Setting.RuleSetting.Text");
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cancelBtn = new System.Windows.Forms.Button();
this.saveBtn = 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.panel2 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.borderColorPanel = new System.Windows.Forms.Panel();
this.backColorPanel = new System.Windows.Forms.Panel();
this.textHeightVal = new System.Windows.Forms.NumericUpDown();
this.backgroundSizeVal = new System.Windows.Forms.NumericUpDown();
this.verticalLineLengthVal = new System.Windows.Forms.NumericUpDown();
this.borderWidthVal = new System.Windows.Forms.NumericUpDown();
this.lineWidthVal = new System.Windows.Forms.NumericUpDown();
this.textFontSizeVal = new System.Windows.Forms.NumericUpDown();
this.lineColorPanel = new System.Windows.Forms.Panel();
this.textColorPanel = new System.Windows.Forms.Panel();
this.textPositionVal = new System.Windows.Forms.ComboBox();
this.label19 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.textFontVal = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.previewGroupBox = new System.Windows.Forms.GroupBox();
this.previewPanel = new System.Windows.Forms.Panel();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.autoRulerValueVal = new System.Windows.Forms.NumericUpDown();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.rulerMarginVal = new System.Windows.Forms.NumericUpDown();
this.label20 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.rulerPositionVal2 = new System.Windows.Forms.RadioButton();
this.rulerPositionVal4 = new System.Windows.Forms.RadioButton();
this.rulerPositionVal3 = new System.Windows.Forms.RadioButton();
this.rulerPositionVal1 = new System.Windows.Forms.RadioButton();
this.label15 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.listView1 = new System.Windows.Forms.ListView();
this.addRulerBtn = new System.Windows.Forms.Button();
this.deleteRulerBtn = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.textHeightVal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.backgroundSizeVal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.verticalLineLengthVal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.borderWidthVal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.lineWidthVal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.textFontSizeVal)).BeginInit();
this.previewGroupBox.SuspendLayout();
this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.autoRulerValueVal)).BeginInit();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.rulerMarginVal)).BeginInit();
this.groupBox6.SuspendLayout();
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.cancelBtn);
this.groupBox1.Controls.Add(this.saveBtn);
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 = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "操作";
//
// cancelBtn
//
this.cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.cancelBtn.Location = new System.Drawing.Point(420, 21);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.Size = new System.Drawing.Size(75, 23);
this.cancelBtn.TabIndex = 1;
this.cancelBtn.Text = "取消";
this.cancelBtn.UseVisualStyleBackColor = true;
this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
//
// saveBtn
//
this.saveBtn.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.saveBtn.Location = new System.Drawing.Point(339, 21);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(75, 23);
this.saveBtn.TabIndex = 0;
this.saveBtn.Text = "确定";
this.saveBtn.UseVisualStyleBackColor = true;
this.saveBtn.Click += new System.EventHandler(this.saveBtn_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.panel2);
this.groupBox2.Controls.Add(this.panel1);
this.groupBox2.Controls.Add(this.borderColorPanel);
this.groupBox2.Controls.Add(this.backColorPanel);
this.groupBox2.Controls.Add(this.textHeightVal);
this.groupBox2.Controls.Add(this.backgroundSizeVal);
this.groupBox2.Controls.Add(this.verticalLineLengthVal);
this.groupBox2.Controls.Add(this.borderWidthVal);
this.groupBox2.Controls.Add(this.lineWidthVal);
this.groupBox2.Controls.Add(this.textFontSizeVal);
this.groupBox2.Controls.Add(this.lineColorPanel);
this.groupBox2.Controls.Add(this.textColorPanel);
this.groupBox2.Controls.Add(this.textPositionVal);
this.groupBox2.Controls.Add(this.label19);
this.groupBox2.Controls.Add(this.label18);
this.groupBox2.Controls.Add(this.label17);
this.groupBox2.Controls.Add(this.textFontVal);
this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Location = new System.Drawing.Point(13, 77);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(508, 167);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "样式设置";
//
// textBold
//
this.textBold.FormattingEnabled = true;
this.textBold.Location = new System.Drawing.Point(84, 138);
this.textBold.Name = "textBold";
this.textBold.Size = new System.Drawing.Size(72, 20);
this.textBold.TabIndex = 55;
this.textBold.SelectedIndexChanged += new System.EventHandler(this.textBold_SelectedIndexChanged);
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(15, 142);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(65, 12);
this.label21.TabIndex = 54;
this.label21.Text = "文字加粗:";
//
// panel2
//
this.panel2.BackColor = System.Drawing.SystemColors.WindowText;
this.panel2.Location = new System.Drawing.Point(333, 13);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1, 146);
this.panel2.TabIndex = 53;
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.WindowText;
this.panel1.Location = new System.Drawing.Point(166, 13);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1, 146);
this.panel1.TabIndex = 53;
//
// borderColorPanel
//
this.borderColorPanel.BackColor = System.Drawing.SystemColors.Window;
this.borderColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.borderColorPanel.Location = new System.Drawing.Point(427, 81);
this.borderColorPanel.Name = "borderColorPanel";
this.borderColorPanel.Size = new System.Drawing.Size(72, 21);
this.borderColorPanel.TabIndex = 52;
this.borderColorPanel.Click += new System.EventHandler(this.borderColorValPanel_Click);
//
// backColorPanel
//
this.backColorPanel.BackColor = System.Drawing.SystemColors.Window;
this.backColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.backColorPanel.Location = new System.Drawing.Point(427, 23);
this.backColorPanel.Name = "backColorPanel";
this.backColorPanel.Size = new System.Drawing.Size(72, 21);
this.backColorPanel.TabIndex = 51;
this.backColorPanel.Click += new System.EventHandler(this.backColorPanel_Click);
//
// textHeightVal
//
this.textHeightVal.Location = new System.Drawing.Point(254, 110);
this.textHeightVal.Name = "textHeightVal";
this.textHeightVal.Size = new System.Drawing.Size(55, 21);
this.textHeightVal.TabIndex = 50;
this.textHeightVal.ValueChanged += new System.EventHandler(this.textHeightVal_ValueChanged);
//
// backgroundSizeVal
//
this.backgroundSizeVal.Location = new System.Drawing.Point(427, 52);
this.backgroundSizeVal.Name = "backgroundSizeVal";
this.backgroundSizeVal.Size = new System.Drawing.Size(55, 21);
this.backgroundSizeVal.TabIndex = 50;
this.backgroundSizeVal.ValueChanged += new System.EventHandler(this.backgroundSizeVal_ValueChanged);
//
// verticalLineLengthVal
//
this.verticalLineLengthVal.Location = new System.Drawing.Point(254, 81);
this.verticalLineLengthVal.Name = "verticalLineLengthVal";
this.verticalLineLengthVal.Size = new System.Drawing.Size(55, 21);
this.verticalLineLengthVal.TabIndex = 50;
this.verticalLineLengthVal.ValueChanged += new System.EventHandler(this.verticalLineLengthVal_ValueChanged);
//
// borderWidthVal
//
this.borderWidthVal.Location = new System.Drawing.Point(427, 109);
this.borderWidthVal.Name = "borderWidthVal";
this.borderWidthVal.Size = new System.Drawing.Size(72, 21);
this.borderWidthVal.TabIndex = 50;
this.borderWidthVal.ValueChanged += new System.EventHandler(this.borderWidthVal_ValueChanged);
//
// lineWidthVal
//
this.lineWidthVal.Location = new System.Drawing.Point(254, 53);
this.lineWidthVal.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.lineWidthVal.Name = "lineWidthVal";
this.lineWidthVal.Size = new System.Drawing.Size(72, 21);
this.lineWidthVal.TabIndex = 50;
this.lineWidthVal.Value = new decimal(new int[] {
1,
0,
0,
0});
this.lineWidthVal.ValueChanged += new System.EventHandler(this.lineWidthVal_ValueChanged);
//
// textFontSizeVal
//
this.textFontSizeVal.Location = new System.Drawing.Point(84, 23);
this.textFontSizeVal.Maximum = new decimal(new int[] {
49000,
0,
0,
0});
this.textFontSizeVal.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.textFontSizeVal.Name = "textFontSizeVal";
this.textFontSizeVal.Size = new System.Drawing.Size(72, 21);
this.textFontSizeVal.TabIndex = 50;
this.textFontSizeVal.Value = new decimal(new int[] {
1,
0,
0,
0});
this.textFontSizeVal.ValueChanged += new System.EventHandler(this.textFontSizeVal_ValueChanged);
//
// lineColorPanel
//
this.lineColorPanel.BackColor = System.Drawing.SystemColors.Window;
this.lineColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lineColorPanel.Location = new System.Drawing.Point(254, 23);
this.lineColorPanel.Name = "lineColorPanel";
this.lineColorPanel.Size = new System.Drawing.Size(72, 21);
this.lineColorPanel.TabIndex = 49;
this.lineColorPanel.Click += new System.EventHandler(this.lineColorPanel_Click);
//
// textColorPanel
//
this.textColorPanel.BackColor = System.Drawing.SystemColors.Window;
this.textColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textColorPanel.Location = new System.Drawing.Point(84, 81);
this.textColorPanel.Name = "textColorPanel";
this.textColorPanel.Size = new System.Drawing.Size(72, 21);
this.textColorPanel.TabIndex = 0;
this.textColorPanel.Click += new System.EventHandler(this.textColorPanel_Click);
//
// textPositionVal
//
this.textPositionVal.FormattingEnabled = true;
this.textPositionVal.Location = new System.Drawing.Point(84, 110);
this.textPositionVal.Name = "textPositionVal";
this.textPositionVal.Size = new System.Drawing.Size(72, 20);
this.textPositionVal.TabIndex = 40;
this.textPositionVal.SelectedIndexChanged += new System.EventHandler(this.textPositionVal_SelectedIndexChanged);
//
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(488, 57);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(11, 12);
this.label19.TabIndex = 37;
this.label19.Text = "%";
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(314, 114);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(11, 12);
this.label18.TabIndex = 35;
this.label18.Text = "%";
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(315, 85);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(11, 12);
this.label17.TabIndex = 32;
this.label17.Text = "%";
//
// textFontVal
//
this.textFontVal.FormattingEnabled = true;
this.textFontVal.Location = new System.Drawing.Point(84, 53);
this.textFontVal.Name = "textFontVal";
this.textFontVal.Size = new System.Drawing.Size(72, 20);
this.textFontVal.TabIndex = 0;
this.textFontVal.SelectedIndexChanged += new System.EventHandler(this.textFontVal_SelectedIndexChanged);
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(349, 114);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(65, 12);
this.label12.TabIndex = 33;
this.label12.Text = "边框线宽:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(182, 114);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(65, 12);
this.label8.TabIndex = 33;
this.label8.Text = "文字高度:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(15, 114);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(65, 12);
this.label4.TabIndex = 33;
this.label4.Text = "文字位置:";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(349, 27);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(65, 12);
this.label11.TabIndex = 27;
this.label11.Text = "背景颜色:";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(349, 85);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(65, 12);
this.label10.TabIndex = 31;
this.label10.Text = "边框颜色:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(182, 27);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 27;
this.label3.Text = "线条颜色:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(182, 85);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 31;
this.label2.Text = "垂线长度:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(349, 57);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(65, 12);
this.label9.TabIndex = 29;
this.label9.Text = "背景大小:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(15, 27);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(65, 12);
this.label7.TabIndex = 27;
this.label7.Text = "文字字号:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(182, 57);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 29;
this.label1.Text = "线条宽度:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(15, 85);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(65, 12);
this.label5.TabIndex = 31;
this.label5.Text = "文字颜色:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(15, 57);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(65, 12);
this.label6.TabIndex = 29;
this.label6.Text = "文字字体:";
//
// previewGroupBox
//
this.previewGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.previewGroupBox.Controls.Add(this.previewPanel);
this.previewGroupBox.Location = new System.Drawing.Point(13, 246);
this.previewGroupBox.Name = "previewGroupBox";
this.previewGroupBox.Size = new System.Drawing.Size(508, 180);
this.previewGroupBox.TabIndex = 4;
this.previewGroupBox.TabStop = false;
this.previewGroupBox.Text = "预览";
//
// previewPanel
//
this.previewPanel.Location = new System.Drawing.Point(7, 12);
this.previewPanel.Name = "previewPanel";
this.previewPanel.Size = new System.Drawing.Size(495, 153);
this.previewPanel.TabIndex = 0;
this.previewPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.previewPanel_Paint);
//
// groupBox4
//
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox4.Controls.Add(this.autoRulerValueVal);
this.groupBox4.Controls.Add(this.label14);
this.groupBox4.Controls.Add(this.label13);
this.groupBox4.Location = new System.Drawing.Point(13, 417);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(246, 90);
this.groupBox4.TabIndex = 5;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "自动标注";
//
// autoRulerValueVal
//
this.autoRulerValueVal.Location = new System.Drawing.Point(110, 37);
this.autoRulerValueVal.Maximum = new decimal(new int[] {
1410065407,
2,
0,
0});
this.autoRulerValueVal.Name = "autoRulerValueVal";
this.autoRulerValueVal.Size = new System.Drawing.Size(117, 21);
this.autoRulerValueVal.TabIndex = 51;
this.autoRulerValueVal.ValueChanged += new System.EventHandler(this.autoRulerValueVal_ValueChanged);
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(150, 61);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(77, 12);
this.label14.TabIndex = 37;
this.label14.Text = "除以放大倍数";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(15, 41);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(89, 12);
this.label13.TabIndex = 35;
this.label13.Text = "自动长度计算:";
//
// groupBox5
//
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox5.Controls.Add(this.rulerMarginVal);
this.groupBox5.Controls.Add(this.label20);
this.groupBox5.Controls.Add(this.label16);
this.groupBox5.Controls.Add(this.rulerPositionVal2);
this.groupBox5.Controls.Add(this.rulerPositionVal4);
this.groupBox5.Controls.Add(this.rulerPositionVal3);
this.groupBox5.Controls.Add(this.rulerPositionVal1);
this.groupBox5.Controls.Add(this.label15);
this.groupBox5.Location = new System.Drawing.Point(269, 417);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(252, 90);
this.groupBox5.TabIndex = 6;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "标尺位置";
//
// rulerMarginVal
//
this.rulerMarginVal.DecimalPlaces = 2;
this.rulerMarginVal.Location = new System.Drawing.Point(77, 57);
this.rulerMarginVal.Name = "rulerMarginVal";
this.rulerMarginVal.Size = new System.Drawing.Size(132, 21);
this.rulerMarginVal.TabIndex = 52;
this.rulerMarginVal.ValueChanged += new System.EventHandler(this.rulerMarginVal_ValueChanged);
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(215, 61);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(11, 12);
this.label20.TabIndex = 51;
this.label20.Text = "%";
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(6, 61);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(65, 12);
this.label16.TabIndex = 43;
this.label16.Text = "标注边距:";
//
// rulerPositionVal2
//
this.rulerPositionVal2.AutoSize = true;
this.rulerPositionVal2.Location = new System.Drawing.Point(155, 13);
this.rulerPositionVal2.Name = "rulerPositionVal2";
this.rulerPositionVal2.Size = new System.Drawing.Size(47, 16);
this.rulerPositionVal2.TabIndex = 42;
this.rulerPositionVal2.TabStop = true;
this.rulerPositionVal2.Text = "右上";
this.rulerPositionVal2.UseVisualStyleBackColor = true;
this.rulerPositionVal2.CheckedChanged += new System.EventHandler(this.rulerPositionVal2_CheckedChanged);
//
// rulerPositionVal4
//
this.rulerPositionVal4.AutoSize = true;
this.rulerPositionVal4.Location = new System.Drawing.Point(155, 35);
this.rulerPositionVal4.Name = "rulerPositionVal4";
this.rulerPositionVal4.Size = new System.Drawing.Size(47, 16);
this.rulerPositionVal4.TabIndex = 41;
this.rulerPositionVal4.TabStop = true;
this.rulerPositionVal4.Text = "右下";
this.rulerPositionVal4.UseVisualStyleBackColor = true;
this.rulerPositionVal4.CheckedChanged += new System.EventHandler(this.rulerPositionVal4_CheckedChanged);
//
// rulerPositionVal3
//
this.rulerPositionVal3.AutoSize = true;
this.rulerPositionVal3.Location = new System.Drawing.Point(100, 35);
this.rulerPositionVal3.Name = "rulerPositionVal3";
this.rulerPositionVal3.Size = new System.Drawing.Size(47, 16);
this.rulerPositionVal3.TabIndex = 40;
this.rulerPositionVal3.TabStop = true;
this.rulerPositionVal3.Text = "左下";
this.rulerPositionVal3.UseVisualStyleBackColor = true;
this.rulerPositionVal3.CheckedChanged += new System.EventHandler(this.rulerPositionVal3_CheckedChanged);
//
// rulerPositionVal1
//
this.rulerPositionVal1.AutoSize = true;
this.rulerPositionVal1.Checked = true;
this.rulerPositionVal1.Location = new System.Drawing.Point(100, 13);
this.rulerPositionVal1.Name = "rulerPositionVal1";
this.rulerPositionVal1.Size = new System.Drawing.Size(47, 16);
this.rulerPositionVal1.TabIndex = 39;
this.rulerPositionVal1.TabStop = true;
this.rulerPositionVal1.Text = "左上";
this.rulerPositionVal1.UseVisualStyleBackColor = true;
this.rulerPositionVal1.CheckedChanged += new System.EventHandler(this.rulerPositionVal1_CheckedChanged);
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(6, 26);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(65, 12);
this.label15.TabIndex = 38;
this.label15.Text = "标尺位置:";
//
// groupBox6
//
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.listView1);
this.groupBox6.Controls.Add(this.addRulerBtn);
this.groupBox6.Controls.Add(this.deleteRulerBtn);
this.groupBox6.Location = new System.Drawing.Point(13, 513);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(508, 122);
this.groupBox6.TabIndex = 7;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "预存标注";
//
// listView1
//
this.listView1.FullRowSelect = true;
this.listView1.GridLines = true;
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(0, 37);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.ShowItemToolTips = true;
this.listView1.Size = new System.Drawing.Size(508, 85);
this.listView1.TabIndex = 5;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
//
// addRulerBtn
//
this.addRulerBtn.Location = new System.Drawing.Point(351, 8);
this.addRulerBtn.Name = "addRulerBtn";
this.addRulerBtn.Size = new System.Drawing.Size(75, 23);
this.addRulerBtn.TabIndex = 4;
this.addRulerBtn.Text = "+";
this.addRulerBtn.UseVisualStyleBackColor = true;
this.addRulerBtn.Click += new System.EventHandler(this.addRulerBtn_Click);
//
// deleteRulerBtn
//
this.deleteRulerBtn.Location = new System.Drawing.Point(427, 8);
this.deleteRulerBtn.Name = "deleteRulerBtn";
this.deleteRulerBtn.Size = new System.Drawing.Size(75, 23);
this.deleteRulerBtn.TabIndex = 2;
this.deleteRulerBtn.Text = "-";
this.deleteRulerBtn.UseVisualStyleBackColor = true;
this.deleteRulerBtn.Click += new System.EventHandler(this.deleteRulerBtn_Click);
//
// RulerSettingDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(533, 646);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.previewGroupBox);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "RulerSettingDialog";
this.ShowIcon = false;
this.Text = "标尺设置";
this.Controls.SetChildIndex(this.groupBox2, 0);
this.Controls.SetChildIndex(this.groupBox1, 0);
this.Controls.SetChildIndex(this.previewGroupBox, 0);
this.Controls.SetChildIndex(this.groupBox4, 0);
this.Controls.SetChildIndex(this.groupBox5, 0);
this.Controls.SetChildIndex(this.groupBox6, 0);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.textHeightVal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.backgroundSizeVal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.verticalLineLengthVal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.borderWidthVal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.lineWidthVal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.textFontSizeVal)).EndInit();
this.previewGroupBox.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.autoRulerValueVal)).EndInit();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.rulerMarginVal)).EndInit();
this.groupBox6.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
#region InitializeComponent2
///
/// 初始化组件
///
private void InitializeComponent2()
{
this.listView1.View = View.Details;
ColumnHeader header = new ColumnHeader();
header.Text = PdnResources.GetString("Menu.name.text");
header.Width = 240;
this.listView1.Columns.Add(header);
header = new ColumnHeader();
header.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text");
header.Width = 240;
this.listView1.Columns.Add(header);
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.textFontVal.DataSource = fontsItems;
this.textPositionVal.DataSource = new string[] { PdnResources.GetString("Menu.Set.Rulersettings.Left.text"),
PdnResources.GetString("Menu.nthemiddle.Text")
, PdnResources.GetString("Menu.Set.Rulersettings.Right.text") };
this.textBold.DataSource = new string[] { PdnResources.GetString("Menu.no.text") ,PdnResources.GetString("Menu.Yes.text")};
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);
}
#endregion
#region addRulerformInit
///
/// 新增预存标注
///
private void addRulerformInit()
{
this.addRulerform.StartPosition = FormStartPosition.CenterScreen;
this.addRulerform.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.addRulerform.FormBorderStyle = FormBorderStyle.FixedSingle;
this.addRulerform.ClientSize = new System.Drawing.Size(330, 105);
this.addRulerform.MaximizeBox = false;
this.addRulerform.MinimizeBox = false;
this.addRulerform.Name = "addRulerDialog";
this.addRulerform.ShowIcon = false;
this.addRulerform.Text = PdnResources.GetString("Menu.Set.Rulersettings.Newpre-storedannotation.text");
Label nameLabel = new Label();
nameLabel.Location = new System.Drawing.Point(15, 15);
nameLabel.Size = new System.Drawing.Size(45, 12);
nameLabel.Name = "nameLabel";
nameLabel.Text = PdnResources.GetString("Menu.name.text")+":";
this.nameValue.Location = new System.Drawing.Point(60, 11);
this.nameValue.Name = "nameValue";
this.nameValue.Size = new System.Drawing.Size(250, 21);
this.nameValue.TextChanged += new System.EventHandler(this.nameValue_TextChanged);
Label lengthLabel = new Label();
lengthLabel.Location = new System.Drawing.Point(15, 42);
lengthLabel.Size = new System.Drawing.Size(45, 12);
lengthLabel.Name = "lengthLabel";
lengthLabel.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text")+":";
this.lengthVal.Location = new System.Drawing.Point(60, 38);
this.lengthVal.Name = "lengthVal";
this.lengthVal.Size = new System.Drawing.Size(50, 21);
this.lengthVal.ValueChanged += new System.EventHandler(this.lengthVal_ValueChanged);
this.lengthVal.Maximum = 9999999999;
Label descriptionLabel = new Label();
descriptionLabel.Location = new System.Drawing.Point(115, 42);
descriptionLabel.Size = new System.Drawing.Size(230, 12);
descriptionLabel.Name = "descriptionLabel";
descriptionLabel.Text = PdnResources.GetString("Menu.Micronoronethousandthofanin.Text");
Button saveButton = new Button();
saveButton.Location = new System.Drawing.Point(235, 69);
saveButton.Name = "saveButton";
saveButton.Size = new System.Drawing.Size(75, 23);
saveButton.Text = PdnResources.GetString("Menu.File.Save.Text");
saveButton.UseVisualStyleBackColor = true;
saveButton.Click += new System.EventHandler(this.saveButton_Click);
this.addRulerform.Controls.Add(nameLabel);
this.addRulerform.Controls.Add(nameValue);
this.addRulerform.Controls.Add(lengthLabel);
this.addRulerform.Controls.Add(lengthVal);
this.addRulerform.Controls.Add(descriptionLabel);
this.addRulerform.Controls.Add(saveButton);
}
#endregion
#endregion
#region 事件
#region 主要窗体事件
private void saveBtn_Click(object sender, EventArgs e)
{
string stageModelXml = XmlSerializeHelper.XmlSerialize(this.rulerModel);
string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Ruler.xml";
if (FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create))
{
Startup.instance.rulerModel = this.rulerModel;
this.Close();
}
else
{
MessageBox.Show(PdnResources.GetString("Menu.Rulerinformationsavingfaile.Text"));
}
}
private void cancelBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void textFontSizeVal_ValueChanged(object sender, EventArgs e)
{
this.rulerModel.textFontSize = this.textFontSizeVal.Value;
this.previewPanel.Invalidate();
}
private void textFontVal_SelectedIndexChanged(object sender, EventArgs e)
{
this.rulerModel.textFont = this.textFontVal.Text;
this.previewPanel.Invalidate();
}
private void textColorPanel_Click(object sender, EventArgs e)
{
this.colorsFormFont.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.textColor));
this.colorsFormFont.setSaveBtn_Click(new System.EventHandler(this.textColorChanged));
this.colorsFormFont.ShowDialog();
}
private void textPositionVal_SelectedIndexChanged(object sender, EventArgs e)
{
this.rulerModel.textPosition = this.textPositionVal.SelectedIndex;
this.previewPanel.Invalidate();
}
private void textBold_SelectedIndexChanged(object sender, EventArgs e)
{
this.rulerModel.textBold = this.textBold.SelectedIndex;
this.previewPanel.Invalidate();
}
private void lineColorPanel_Click(object sender, EventArgs e)
{
this.colorsFormLine.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.lineColor));
this.colorsFormLine.setSaveBtn_Click(new System.EventHandler(this.lineColorChanged));
this.colorsFormLine.ShowDialog();
}
private void lineWidthVal_ValueChanged(object sender, EventArgs e)
{
this.rulerModel.lineWidth = this.lineWidthVal.Value;
this.previewPanel.Invalidate();
}
private void verticalLineLengthVal_ValueChanged(object sender, EventArgs e)
{
this.rulerModel.verticalLineLength = this.verticalLineLengthVal.Value;
this.previewPanel.Invalidate();
}
private void textHeightVal_ValueChanged(object sender, EventArgs e)
{
this.rulerModel.textHeight = this.textHeightVal.Value;
this.previewPanel.Invalidate();
}
private void backColorPanel_Click(object sender, EventArgs e)
{
this.colorsFormBackground.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.backColor));
this.colorsFormBackground.setSaveBtn_Click(new System.EventHandler(this.backColorChanged));
this.colorsFormBackground.ShowDialog();
}
private void backgroundSizeVal_ValueChanged(object sender, EventArgs e)
{
this.rulerModel.backgroundSize = this.backgroundSizeVal.Value;
this.previewPanel.Invalidate();
}
private void borderColorValPanel_Click(object sender, EventArgs e)
{
this.colorsFormBorder.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.borderColor));
this.colorsFormBorder.setSaveBtn_Click(new System.EventHandler(this.borderColorChanged));
this.colorsFormBorder.ShowDialog();
}
private void borderWidthVal_ValueChanged(object sender, EventArgs e)
{
this.rulerModel.borderWidth = this.borderWidthVal.Value;
this.previewPanel.Invalidate();
}
private void autoRulerValueVal_ValueChanged(object sender, EventArgs e)
{
this.rulerModel.autoRulerValue = this.autoRulerValueVal.Value;
}
private void rulerPositionVal1_CheckedChanged(object sender, EventArgs e)
{
this.rulerModel.rulerPosition = 1;
}
private void rulerPositionVal2_CheckedChanged(object sender, EventArgs e)
{
this.rulerModel.rulerPosition = 2;
}
private void rulerPositionVal3_CheckedChanged(object sender, EventArgs e)
{
this.rulerModel.rulerPosition = 3;
}
private void rulerPositionVal4_CheckedChanged(object sender, EventArgs e)
{
this.rulerModel.rulerPosition = 4;
}
private void rulerMarginVal_ValueChanged(object sender, EventArgs e)
{
this.rulerModel.rulerMargin = this.rulerMarginVal.Value;
}
private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
{
}
private void textColorChanged(object sender, EventArgs e)
{
this.textColorPanel.BackColor = this.colorsFormFont.UserPrimaryColor.ToColor();
this.rulerModel.textColor = this.colorsFormFont.UserPrimaryColor.ToColor().ToArgb();
this.colorsFormFont.Close();
this.previewPanel.Invalidate();
}
private void lineColorChanged(object sender, EventArgs e)
{
this.lineColorPanel.BackColor = this.colorsFormLine.UserPrimaryColor.ToColor();
this.rulerModel.lineColor = this.colorsFormLine.UserPrimaryColor.ToColor().ToArgb();
this.colorsFormLine.Close();
this.previewPanel.Invalidate();
}
private void backColorChanged(object sender, EventArgs e)
{
this.backColorPanel.BackColor = this.colorsFormBackground.UserPrimaryColor.ToColor();
this.rulerModel.backColor = this.colorsFormBackground.UserPrimaryColor.ToColor().ToArgb();
this.colorsFormBackground.Close();
this.previewPanel.Invalidate();
}
private void borderColorChanged(object sender, EventArgs e)
{
this.borderColorPanel.BackColor = this.colorsFormBorder.UserPrimaryColor.ToColor();
this.rulerModel.borderColor = this.colorsFormBorder.UserPrimaryColor.ToColor().ToArgb();
this.colorsFormBorder.Close();
this.previewPanel.Invalidate();
}
private void previewPanel_Paint(object sender, PaintEventArgs e)
{
Point center = new Point(this.previewPanel.Width / 2, this.previewPanel.Height * 3 / 4);
DrawRulerHelper.drawRuler(this.rulerModel, e.Graphics, center, 200, "100μm", out RectangleF rectangleF);
}
private void addRulerBtn_Click(object sender, EventArgs e)
{
this.nameValue.Text = null;
this.lengthVal.Value = 0;
this.addRulerform.ShowDialog(this);
}
private void deleteRulerBtn_Click(object sender, EventArgs e)
{
if (this.listView1.SelectedItems.Count <= 0)
return;
if (MessageBox.Show(PdnResources.GetString("Menu.eyousureyouwanttodeletetheselectedsaved.Text")+"?", PdnResources.GetString("Menu.Thisdeletioncannotberecovered.text"), MessageBoxButtons.YesNo) == DialogResult.Yes)
{
ListViewItem item = this.listView1.SelectedItems[0];
int indexNum = item.Index;
bool reSelected = false;
if (indexNum > 0 && indexNum + 1 != this.listView1.Items.Count)
reSelected = true;
this.rulerModel.presetRulers.Remove(this.rulerModel.presetRulers[item.Index]);
this.buildListView();
if (reSelected)
{
this.listView1.Items[indexNum].Selected = true;
}
}
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
ListViewItem defaultItem = new ListViewItem();
foreach (ListViewItem listViewItem in this.listView1.Items)
{
listViewItem.ForeColor = defaultItem.ForeColor;
listViewItem.BackColor = defaultItem.BackColor;
}
if (this.listView1.SelectedItems.Count <= 0)
{
return;
}
ListViewItem item = this.listView1.SelectedItems[0];
item.ForeColor = Color.White;
item.BackColor = Color.FromArgb(0, 120, 215);
}
#endregion
#region 新增预存标注窗体事件
private void nameValue_TextChanged(object sender, EventArgs e)
{
this.tempPresetRuler.name = ((TextBox)sender).Text;
}
private void lengthVal_ValueChanged(object sender, EventArgs e)
{
this.tempPresetRuler.length = ((NumericUpDown)sender).Value;
}
private void saveButton_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(this.tempPresetRuler.name))
{
MessageBox.Show(PdnResources.GetString("Menu.Pleasefillinthename.Text"));
return;
}
this.rulerModel.presetRulers.Add(this.tempPresetRuler);
this.tempPresetRuler = new PresetRuler();
buildListView();
this.addRulerform.Close();
}
#endregion
#endregion
#region 读取数据
///
/// 读取数据
///
private void readData()
{
//this.rulerModel = Startup.instance.rulerModel;//原有获取方式改变设置项后标尺样式即时刷新
this.rulerModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Ruler.xml", FileMode.Open));
this.textFontSizeVal.Value = this.rulerModel.textFontSize;
this.textFontVal.Text = this.rulerModel.textFont;
//this.textColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.textColor));
this.textPositionVal.SelectedIndex = this.rulerModel.textPosition;
this.textBold.SelectedIndex = this.rulerModel.textBold;
//this.lineColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.lineColor));
this.lineWidthVal.Value = this.rulerModel.lineWidth;
this.verticalLineLengthVal.Value = this.rulerModel.verticalLineLength;
this.textHeightVal.Value = this.rulerModel.textHeight;
//this.backColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.backColor));
this.backgroundSizeVal.Value = this.rulerModel.backgroundSize;
//this.borderColorVal.UserPrimaryColor = ColorBgra.FromColor(Color.FromArgb(this.rulerModel.borderColor));
this.borderWidthVal.Value = this.rulerModel.borderWidth;
this.textColorPanel.BackColor = Color.FromArgb(this.rulerModel.textColor);
this.lineColorPanel.BackColor = Color.FromArgb(this.rulerModel.lineColor);
this.backColorPanel.BackColor = Color.FromArgb(this.rulerModel.backColor);
this.borderColorPanel.BackColor = Color.FromArgb(this.rulerModel.borderColor);
this.autoRulerValueVal.Value = this.rulerModel.autoRulerValue;
switch (this.rulerModel.rulerPosition)
{
case 1: this.rulerPositionVal1.Checked = true; break;
case 2: this.rulerPositionVal2.Checked = true; break;
case 3: this.rulerPositionVal3.Checked = true; break;
case 4: this.rulerPositionVal4.Checked = true; break;
}
this.rulerMarginVal.Value = this.rulerModel.rulerMargin;
}
#endregion
#region 其他
///
/// 构建ListView数据
///
private void buildListView()
{
this.listView1.Items.Clear();
this.listView1.BeginUpdate();
foreach (PresetRuler presetRuler in this.rulerModel.presetRulers)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = presetRuler.name.ToString();
lvi.SubItems.Add(presetRuler.length.ToString());
this.listView1.Items.Add(lvi);
}
this.listView1.EndUpdate();
if (this.listView1.Items.Count > 0)
{
this.listView1.Items[0].Selected = true;
}
}
#endregion
}
}