12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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 OTSExtremum
- {
- public partial class InputText : Form
- {
- public InputText()
- {
- InitializeComponent();
- }
- public delegate void TextEventHandler(string strText);
- public TextEventHandler TextHandler;
- private void btnOK_Click(object sender, EventArgs e)
- {
- if (null != TextHandler)
- {
- TextHandler.Invoke(txtString.Text);
- DialogResult = DialogResult.OK;
- }
- }
- private void btnCancel_Click(object sender, EventArgs e)
- {
- DialogResult = DialogResult.Cancel;
- }
- private void txtString_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Keys.Enter == (Keys)e.KeyChar)
- {
- if (null != TextHandler)
- {
- TextHandler.Invoke(txtString.Text);
- DialogResult = DialogResult.OK;
- }
- }
- }
- }
- }
|