CreateNameDialog.cs 4.8 KB

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