此程式碼是網路上找來別人寫好的C# InputBox Funtion Code,只是我看不大懂,例如我今天輸入一個字串,那他會存在哪個記憶體位置?還有如果我要增加一個當按下Enter時跟按下btnOK一樣的動作時要怎麼寫?
問題還很多一時問不清楚ˊˋ,初學者,請見諒  
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication1
{
   #region InputBox return result
   /// <summary>
   /// Class used to store the result of an InputBox.Show message.
   /// </summary>
   public class InputBoxResult 
   {
     public DialogResult ReturnCode;
     public string Text;
   }
   #endregion
   /// <summary>
   /// Summary description for InputBox.
   /// </summary>
   public class InputBox
   {
     #region Private Windows Contols and Constructor
     // Create a new instance of the form.
     private static Form frmInputDialog;
     private static Label lblPrompt;
     private static Button btnOK;
     private static Button btnCancel;
     private static TextBox txtInput;
     public InputBox()
     {
     }
     #endregion
     #region Private Variables
     private static string _formCaption = string.Empty;
     private static string _formPrompt = string.Empty;
     private static InputBoxResult _outputResponse = new InputBoxResult();
     private static string _defaultValue = string.Empty;
     private static int _xPos = -1;
     private static int _yPos = -1;
     #endregion
     #region Windows Form code
     private static void InitializeComponent()
     {
       // Create a new instance of the form.
       frmInputDialog = new Form();
       lblPrompt = new Label();
       btnOK = new Button();
       btnCancel = new Button();
       txtInput = new TextBox();
       frmInputDialog.SuspendLayout();
       // 
       // lblPrompt
       // 
       lblPrompt.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right)));
       lblPrompt.BackColor = SystemColors.Control;
       lblPrompt.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((Byte)(0)));
       lblPrompt.Location = new Point(12, 9);
       lblPrompt.Name = "lblPrompt";
       lblPrompt.Size = new Size(302, 82);
       lblPrompt.TabIndex = 3;
       // 
       // btnOK
       // 
       btnOK.DialogResult = DialogResult.OK;
       btnOK.FlatStyle = FlatStyle.Popup;
       btnOK.Location = new Point(326, 8);
       btnOK.Name = "btnOK";
       btnOK.Size = new Size(64, 24);
       btnOK.TabIndex = 1;
       btnOK.Text = "&OK";
       btnOK.Click += new EventHandler(btnOK_Click);
       // 
       // btnCancel
       // 
       btnCancel.DialogResult = DialogResult.Cancel;
       btnCancel.FlatStyle = FlatStyle ..
訪客只能看到部份內容,免費 加入會員 或由臉書  Google  可以看到全部內容
 可以看到全部內容