123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- 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
- {
- /// <summary>
- /// 另存为窗口
- /// </summary>
- 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();
- }
- /// <summary>
- /// 设置值,用于修改
- /// </summary>
- 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();
- }
- }
- }
|