InputBox.cs 872 B

1234567891011121314151617181920212223242526272829303132333435
  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.Windows.Forms;
  9. namespace PicSo
  10. {
  11. public partial class InputBox : Form
  12. {
  13. public InputBox()
  14. {
  15. InitializeComponent();
  16. }
  17. public string InputText { get; set; }
  18. private void btn_OK_Click(object sender, EventArgs e)
  19. {
  20. this.InputText = this.textBox1.Text;
  21. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  22. }
  23. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  24. {
  25. if (e.KeyChar==13)
  26. {
  27. this.InputText = this.textBox1.Text;
  28. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  29. }
  30. }
  31. }
  32. }