using System;
using System.Collections;
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 PaintDotNet.DedicatedAnalysis.VermiculateCastIron.GBT26656_2011
{
///
/// 字体设置
///
internal class VermiculateCastIronSetFontDialog : PdnBaseForm
{
private GroupBox groupBox1;
private Button button2;
private GroupBox groupBox2;
private Label label1;
private ComboBox comboBox2;
private ComboBox comboBox1;
private Label label2;
private Button button1;
private VermiculateCastIronGBT26656Classification mainForm;
private Label label3;
private Panel panel1;
private int[] fontSizes = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
PaintDotNet.ColorsForm colorsForm1;
public VermiculateCastIronSetFontDialog(VermiculateCastIronGBT26656Classification mainForm)
{
this.mainForm = mainForm;
InitializeComponent();
InitializeLanguageText();
InitializeOthers();
}
private void InitializeLanguageText()
{
this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
this.button2.Text = PdnResources.GetString("ConfirmLanguageDialog.CancelTB.ActionText");
this.button1.Text = PdnResources.GetString("Menu.confirm.Text");
this.groupBox2.Text = PdnResources.GetString("Menu.fonet.Text");
this.label3.Text = PdnResources.GetString("Menu.fontcolor.text") + ":";
this.label2.Text = PdnResources.GetString("Menu.Fontsize.text") + ":";
this.label1.Text = PdnResources.GetString("Menu.Font.text") + ":";
this.Text = PdnResources.GetString("Menu.fonet.Text");
}
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.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.button2);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Location = new System.Drawing.Point(13, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(283, 49);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
//
// button2
//
this.button2.Location = new System.Drawing.Point(211, 17);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(58, 22);
this.button2.TabIndex = 1;
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(136, 17);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(58, 22);
this.button1.TabIndex = 0;
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.panel1);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.comboBox2);
this.groupBox2.Controls.Add(this.comboBox1);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Location = new System.Drawing.Point(13, 68);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(283, 103);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Location = new System.Drawing.Point(120, 76);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(111, 20);
this.panel1.TabIndex = 5;
this.panel1.Click += new System.EventHandler(this.panel1_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(51, 79);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 4;
//
// comboBox2
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(120, 46);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(111, 20);
this.comboBox2.TabIndex = 3;
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(120, 16);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(111, 20);
this.comboBox1.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(51, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(51, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 0;
//
// VermiculateCastIronSetFontDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.ClientSize = new System.Drawing.Size(308, 184);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "VermiculateCastIronSetFontDialog";
this.Controls.SetChildIndex(this.groupBox1, 0);
this.Controls.SetChildIndex(this.groupBox2, 0);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
private void InitializeOthers()
{
ArrayList fontsItems = new ArrayList();
System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
foreach (FontFamily fontFamily in fonts.Families)
{
fontsItems.Add(fontFamily.Name);
}
this.comboBox1.DataSource = fontsItems;
this.comboBox1.Text = this.mainForm.fontStyle;
this.comboBox2.DataSource = fontSizes;
this.comboBox2.Text = this.mainForm.fontSize + "";
this.colorsForm1 = new ColorsForm();
this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
this.panel1.BackColor = this.mainForm.fontColor;
}
private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
{
}
///
/// 取消按钮
///
///
///
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
///
/// 确认按钮
///
///
///
private void button1_Click(object sender, EventArgs e)
{
this.mainForm.SetVermiculateCastIronFont(this.comboBox1.SelectedItem.ToString(), float.Parse(this.comboBox2.SelectedItem.ToString()), this.panel1.BackColor);
this.Close();
}
///
/// 字体颜色被点击
///
///
///
private void panel1_Click(object sender, EventArgs e)
{
this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
this.colorsForm1.ShowDialog();
}
private void colorsForm1Changed(object sender, EventArgs e)
{
this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
this.colorsForm1.Close();
}
}
}