123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- 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
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- 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");
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- 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
- /// <summary>
- /// 调色板
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 调色板回调函数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ce"></param>
- 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();
- }
- }
- }
|