CreateNameDialog.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using PaintDotNet.Instrument;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace PaintDotNet
  12. {
  13. /// <summary>
  14. /// 另存为窗口
  15. /// </summary>
  16. public partial class CreateNameDialog : PdnBaseForm
  17. {
  18. private PdnBaseForm pdnBaseForm;
  19. public TextBox textBox1;
  20. private Button button1;
  21. private Button button2;
  22. private Label label1;
  23. public CreateNameDialog(PdnBaseForm pdnBaseForm)
  24. {
  25. this.pdnBaseForm = pdnBaseForm;
  26. InitializeComponent();
  27. InitializeLanguageText();
  28. }
  29. /// <summary>
  30. /// 设置值,用于修改
  31. /// </summary>
  32. public void SetTextBoxValue(string name)
  33. {
  34. this.textBox1.Text = name;
  35. }
  36. public void SetThisText(string name)
  37. {
  38. this.Text = name;
  39. }
  40. private void InitializeLanguageText()
  41. {
  42. this.label1.Text = PdnResources.GetString("Menu.name.text");
  43. //this.button1.Text = PdnResources.GetString("Menu.File.Save.Text");
  44. if (this.pdnBaseForm is ProjectEngineering)
  45. {
  46. this.button1.Text = PdnResources.GetString("Form.OkButton.Text");
  47. }
  48. else
  49. {
  50. this.button1.Text = PdnResources.GetString("Menu.File.Save.Text");
  51. }
  52. this.button2.Text = PdnResources.GetString("Menu.File.Close.Text");
  53. this.Text = PdnResources.GetString("Menu.Pleaseenteranameofthephase.text");
  54. }
  55. private void InitializeComponent()
  56. {
  57. this.label1 = new System.Windows.Forms.Label();
  58. this.textBox1 = new System.Windows.Forms.TextBox();
  59. this.button1 = new System.Windows.Forms.Button();
  60. this.button2 = new System.Windows.Forms.Button();
  61. this.SuspendLayout();
  62. //
  63. // label1
  64. //
  65. this.label1.AutoSize = true;
  66. this.label1.Location = new System.Drawing.Point(13, 17);
  67. this.label1.Name = "label1";
  68. this.label1.Size = new System.Drawing.Size(41, 12);
  69. this.label1.TabIndex = 0;
  70. this.label1.Text = "名称:";
  71. //
  72. // textBox1
  73. //
  74. this.textBox1.Location = new System.Drawing.Point(60, 13);
  75. this.textBox1.MaxLength = 10;
  76. this.textBox1.Name = "textBox1";
  77. this.textBox1.Size = new System.Drawing.Size(212, 21);
  78. this.textBox1.TabIndex = 1;
  79. //
  80. // button1
  81. //
  82. this.button1.Location = new System.Drawing.Point(115, 53);
  83. this.button1.Name = "button1";
  84. this.button1.Size = new System.Drawing.Size(75, 23);
  85. this.button1.TabIndex = 2;
  86. this.button1.Text = "保存";
  87. this.button1.UseVisualStyleBackColor = true;
  88. this.button1.Click += new System.EventHandler(this.button1_Click);
  89. //
  90. // button2
  91. //
  92. this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  93. this.button2.Location = new System.Drawing.Point(197, 53);
  94. this.button2.Name = "button2";
  95. this.button2.Size = new System.Drawing.Size(75, 23);
  96. this.button2.TabIndex = 3;
  97. this.button2.Text = "关闭";
  98. this.button2.UseVisualStyleBackColor = true;
  99. this.button2.Click += new System.EventHandler(this.button2_Click);
  100. //
  101. // CreateNameDialog
  102. //
  103. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  104. this.AutoSize = true;
  105. this.ClientSize = new System.Drawing.Size(284, 88);
  106. this.Controls.Add(this.button2);
  107. this.Controls.Add(this.button1);
  108. this.Controls.Add(this.textBox1);
  109. this.Controls.Add(this.label1);
  110. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  111. this.MaximizeBox = false;
  112. this.MinimizeBox = false;
  113. this.Name = "CreateNameDialog";
  114. this.Text = "新建";
  115. this.Controls.SetChildIndex(this.label1, 0);
  116. this.Controls.SetChildIndex(this.textBox1, 0);
  117. this.Controls.SetChildIndex(this.button1, 0);
  118. this.Controls.SetChildIndex(this.button2, 0);
  119. this.ResumeLayout(false);
  120. this.PerformLayout();
  121. }
  122. private void button1_Click(object sender, EventArgs e)
  123. {
  124. if (string.IsNullOrEmpty(this.textBox1.Text))
  125. {
  126. MessageBox.Show(PdnResources.GetString("Menu.Pleaseenteranameofthephase.text"));
  127. return;
  128. }
  129. this.pdnBaseForm.GetCreateName(this.textBox1.Text);
  130. }
  131. private void button2_Click(object sender, EventArgs e)
  132. {
  133. this.Close();
  134. }
  135. }
  136. }