using PaintDotNet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Metis.DedicatedAnalysis.DuctileIron.GBT9441_2009.PearliteNumber
{
public class DisplaySetting : Form
{
#region
///
/// 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);
}
#region Windows Form Designer generated code
private void InitializeLanguageText()
{
this.groupBox2.Text = PdnResources.GetString("Menu.Colorsetting.text");
this.label2.Text = PdnResources.GetString("Menu.fontcolor.text");
this.label1.Text = PdnResources.GetString("Menu.Fontsize.text");
this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
this.btnClose.Text = PdnResources.GetString("Menu.File.Close.Text");
this.btnPreservation.Text = PdnResources.GetString("CommonAction.Save");
this.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.comboFontSize = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panelColour = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnClose = new System.Windows.Forms.Button();
this.btnPreservation = new System.Windows.Forms.Button();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboFontSize)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.comboFontSize);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.panelColour);
this.groupBox2.Location = new System.Drawing.Point(3, 77);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(597, 130);
this.groupBox2.TabIndex = 4;
this.groupBox2.TabStop = false;
//
// comboFontSize
//
this.comboFontSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.comboFontSize.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboFontSize.Location = new System.Drawing.Point(66, 31);
this.comboFontSize.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.comboFontSize.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.comboFontSize.Name = "comboFontSize";
this.comboFontSize.Size = new System.Drawing.Size(70, 26);
this.comboFontSize.TabIndex = 11;
this.comboFontSize.Value = new decimal(new int[] {
10,
0,
0,
0});
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(152, 37);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(0, 12);
this.label2.TabIndex = 8;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(22, 37);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 12);
this.label1.TabIndex = 7;
//
// panelColour
//
this.panelColour.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.panelColour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelColour.Location = new System.Drawing.Point(223, 30);
this.panelColour.Name = "panelColour";
this.panelColour.Size = new System.Drawing.Size(70, 27);
this.panelColour.TabIndex = 6;
this.panelColour.Click += new System.EventHandler(this.panelColour_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnClose);
this.groupBox1.Controls.Add(this.btnPreservation);
this.groupBox1.Location = new System.Drawing.Point(3, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(597, 64);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
//
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(399, 21);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(84, 30);
this.btnClose.TabIndex = 4;
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnPreservation
//
this.btnPreservation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnPreservation.Location = new System.Drawing.Point(500, 21);
this.btnPreservation.Name = "btnPreservation";
this.btnPreservation.Size = new System.Drawing.Size(84, 30);
this.btnPreservation.TabIndex = 3;
this.btnPreservation.UseVisualStyleBackColor = true;
this.btnPreservation.Click += new System.EventHandler(this.btnPreservation_Click);
//
// DisplaySetting
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(604, 214);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "DisplaySetting";
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.comboFontSize)).EndInit();
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.NumericUpDown comboFontSize;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panelColour;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnPreservation;
#endregion
///
/// 调色板
///
PaintDotNet.ColorsForm colorsForm;
public DisplaySetting()
{
InitializeComponent();
InitializeLanguageText();
InitOtherTools();
}
private void InitOtherTools()
{
//
//调色板
//
this.colorsForm = new ColorsForm();
this.colorsForm.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
if (PearliteNumberDialog.pearliteNumberDialog.colourFont != null)
{
this.comboFontSize.Text = PearliteNumberDialog.pearliteNumberDialog.colourFont.Keys.First();
this.panelColour.BackColor = PearliteNumberDialog.pearliteNumberDialog.colourFont.Values.First();
}
else
{
this.comboFontSize.Text = 10.ToString();
this.panelColour.BackColor = Color.Black;
}
}
///
/// 调色板回调函数
///
///
///
private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
{
}
private void panelColour_Click(object sender, EventArgs e)
{
this.colorsForm.UserPrimaryColor = ColorBgra.FromColor(this.panelColour.BackColor);
this.colorsForm.setSaveBtn_Click(new System.EventHandler(this.colorsFormChanged));
this.colorsForm.ShowDialog();
}
private void colorsFormChanged(object sender, EventArgs e)
{
this.panelColour.BackColor = this.colorsForm.UserPrimaryColor.ToColor();
this.colorsForm.Close();
}
private void btnPreservation_Click(object sender, EventArgs e)
{
PearliteNumberDialog.pearliteNumberDialog.colourFont.Clear();
PearliteNumberDialog.pearliteNumberDialog.colourFont.Add(this.comboFontSize.Text, this.panelColour.BackColor);
if (PearliteNumberDialog.pearliteNumberDialog.checkBox5.Checked)
{
PearliteNumberDialog.pearliteNumberDialog.AddPictureBoxEvent();
PearliteNumberDialog.pearliteNumberDialog.documentWorkspace.Refresh();
}
this.Close();
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
}
}