EditViewDialog.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace PaintDotNet.FieldView
  11. {
  12. /// <summary>
  13. /// 重命名视场窗口
  14. /// </summary>
  15. public partial class EditViewDialog : PdnBaseForm
  16. {
  17. private PdnBaseForm pdnBaseForm;
  18. public TextBox textBox1;
  19. private Button button1;
  20. private Button button2;
  21. private Label label2;
  22. public RichTextBox richTextBox1;
  23. private Label label1;
  24. public EditViewDialog(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. private void InitializeLanguageText()
  38. {
  39. this.label1.Text = PdnResources.GetString("Menu.name.text") + ":";
  40. this.button1.Text = PdnResources.GetString("Menu.File.Save.Text");
  41. this.button2.Text = PdnResources.GetString("Menu.File.Close.Text");
  42. this.label2.Text = PdnResources.GetString("Menu.describe.Text") + ":";
  43. this.Text = PdnResources.GetString("Menu.Pleaseenteranameofthephase.text");
  44. }
  45. private void InitializeComponent()
  46. {
  47. this.label1 = new System.Windows.Forms.Label();
  48. this.textBox1 = new System.Windows.Forms.TextBox();
  49. this.button1 = new System.Windows.Forms.Button();
  50. this.button2 = new System.Windows.Forms.Button();
  51. this.label2 = new System.Windows.Forms.Label();
  52. this.richTextBox1 = new System.Windows.Forms.RichTextBox();
  53. this.SuspendLayout();
  54. //
  55. // label1
  56. //
  57. this.label1.AutoSize = true;
  58. this.label1.Location = new System.Drawing.Point(13, 17);
  59. this.label1.Name = "label1";
  60. this.label1.Size = new System.Drawing.Size(41, 12);
  61. this.label1.TabIndex = 0;
  62. this.label1.Text = "名称:";
  63. //
  64. // textBox1
  65. //
  66. this.textBox1.Location = new System.Drawing.Point(60, 13);
  67. this.textBox1.MaxLength = 10;
  68. this.textBox1.Name = "textBox1";
  69. this.textBox1.Size = new System.Drawing.Size(212, 21);
  70. this.textBox1.TabIndex = 1;
  71. //
  72. // button1
  73. //
  74. this.button1.Location = new System.Drawing.Point(115, 140);
  75. this.button1.Name = "button1";
  76. this.button1.Size = new System.Drawing.Size(75, 23);
  77. this.button1.TabIndex = 2;
  78. this.button1.Text = "保存";
  79. this.button1.UseVisualStyleBackColor = true;
  80. this.button1.Click += new System.EventHandler(this.button1_Click);
  81. //
  82. // button2
  83. //
  84. this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  85. this.button2.Location = new System.Drawing.Point(197, 140);
  86. this.button2.Name = "button2";
  87. this.button2.Size = new System.Drawing.Size(75, 23);
  88. this.button2.TabIndex = 3;
  89. this.button2.Text = "关闭";
  90. this.button2.UseVisualStyleBackColor = true;
  91. this.button2.Click += new System.EventHandler(this.button2_Click);
  92. //
  93. // label2
  94. //
  95. this.label2.AutoSize = true;
  96. this.label2.Location = new System.Drawing.Point(13, 48);
  97. this.label2.Name = "label2";
  98. this.label2.Size = new System.Drawing.Size(41, 12);
  99. this.label2.TabIndex = 4;
  100. this.label2.Text = "描述:";
  101. //
  102. // richTextBox1
  103. //
  104. this.richTextBox1.Location = new System.Drawing.Point(60, 48);
  105. this.richTextBox1.Name = "richTextBox1";
  106. this.richTextBox1.Size = new System.Drawing.Size(212, 76);
  107. this.richTextBox1.TabIndex = 5;
  108. this.richTextBox1.Text = "";
  109. //
  110. // EditViewDialog
  111. //
  112. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  113. this.AutoSize = true;
  114. this.ClientSize = new System.Drawing.Size(284, 175);
  115. this.Controls.Add(this.richTextBox1);
  116. this.Controls.Add(this.label2);
  117. this.Controls.Add(this.button2);
  118. this.Controls.Add(this.button1);
  119. this.Controls.Add(this.textBox1);
  120. this.Controls.Add(this.label1);
  121. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  122. this.MaximizeBox = false;
  123. this.MinimizeBox = false;
  124. this.Name = "EditViewDialog";
  125. this.Text = "重命名";
  126. this.Controls.SetChildIndex(this.label1, 0);
  127. this.Controls.SetChildIndex(this.textBox1, 0);
  128. this.Controls.SetChildIndex(this.button1, 0);
  129. this.Controls.SetChildIndex(this.button2, 0);
  130. this.Controls.SetChildIndex(this.label2, 0);
  131. this.Controls.SetChildIndex(this.richTextBox1, 0);
  132. this.ResumeLayout(false);
  133. this.PerformLayout();
  134. }
  135. private void button1_Click(object sender, EventArgs e)
  136. {
  137. if (string.IsNullOrEmpty(this.textBox1.Text))
  138. {
  139. MessageBox.Show(PdnResources.GetString("Menu.Pleaseenteranameofthephase.text"));
  140. return;
  141. }
  142. this.pdnBaseForm.GetCreateName(this.textBox1.Text, this.richTextBox1.Text);
  143. }
  144. private void button2_Click(object sender, EventArgs e)
  145. {
  146. this.Close();
  147. }
  148. }
  149. }