using PaintDotNet.Instrument;
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 PaintDotNet
{
///
/// 另存为窗口
///
public partial class CreateNameDialog : PdnBaseForm
{
private PdnBaseForm pdnBaseForm;
public TextBox textBox1;
private Button button1;
private Button button2;
private Label label1;
public CreateNameDialog(PdnBaseForm pdnBaseForm)
{
this.pdnBaseForm = pdnBaseForm;
InitializeComponent();
InitializeLanguageText();
}
///
/// 设置值,用于修改
///
public void SetTextBoxValue(string name)
{
this.textBox1.Text = name;
}
public void SetThisText(string name)
{
this.Text = name;
}
private void InitializeLanguageText()
{
this.label1.Text = PdnResources.GetString("Menu.name.text");
//this.button1.Text = PdnResources.GetString("Menu.File.Save.Text");
if (this.pdnBaseForm is ProjectEngineering)
{
this.button1.Text = PdnResources.GetString("Form.OkButton.Text");
}
else
{
this.button1.Text = PdnResources.GetString("Menu.File.Save.Text");
}
this.button2.Text = PdnResources.GetString("Menu.File.Close.Text");
this.Text = PdnResources.GetString("Menu.Pleaseenteranameofthephase.text");
}
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 0;
this.label1.Text = "名称:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(60, 13);
this.textBox1.MaxLength = 10;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(212, 21);
this.textBox1.TabIndex = 1;
//
// button1
//
this.button1.Location = new System.Drawing.Point(115, 53);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = "保存";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(197, 53);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 3;
this.button2.Text = "关闭";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// CreateNameDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(284, 88);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CreateNameDialog";
this.Text = "新建";
this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.textBox1, 0);
this.Controls.SetChildIndex(this.button1, 0);
this.Controls.SetChildIndex(this.button2, 0);
this.ResumeLayout(false);
this.PerformLayout();
}
private void button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.textBox1.Text))
{
MessageBox.Show(PdnResources.GetString("Menu.Pleaseenteranameofthephase.text"));
return;
}
this.pdnBaseForm.GetCreateName(this.textBox1.Text);
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}