日期:2014-05-19  浏览次数:21459 次

c#有没有类似messagebox的对话框可以输入数据
c#有没有类似messagebox的对话框,但是可以输入数据然由当前窗体获得?

------解决方案--------------------
自己作一个。
#region InputBox
private System.Windows.Forms.TextBox txtData;
private System.Windows.Forms.Label lblInfo;
private System.ComponentModel.Container components = null;

private MsgBox()
{
InitializeComponent();
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}

private void InitializeComponent()
{
this.txtData = new System.Windows.Forms.TextBox();
this.lblInfo = new System.Windows.Forms.Label();
this.BT_OK = new System.Windows.Forms.Button();
this.BT_Canncel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtData
//
this.txtData.Font = new System.Drawing.Font( "宋体 ", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtData.Location = new System.Drawing.Point(142, 16);
this.txtData.Name = "txtData ";
this.txtData.Size = new System.Drawing.Size(184, 23);
this.txtData.TabIndex = 0;
this.txtData.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtData_KeyDown);
//
// lblInfo
//
this.lblInfo.BackColor = System.Drawing.SystemColors.Info;
this.lblInfo.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblInfo.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.lblInfo.Font = new System.Drawing.Font( "宋体 ", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInfo.ForeColor = System.Drawing.Color.Gray;
this.lblInfo.Location = new System.Drawing.Point(21, 16);
this.lblInfo.Name = "lblInfo ";
this.lblInfo.Size = new System.Drawing.Size(98, 23);
this.lblInfo.TabIndex = 1;
this.lblInfo.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// BT_OK
//
this.BT_OK.Location = new System.Drawing.Point(142, 59);
this.BT_OK.Name = "BT_OK ";
this.BT_OK.Size = new System.Drawing.Size(80, 23);
this.BT_OK.TabIndex = 2;
this.BT_OK.Text = "[Enter]确定 ";
this.BT_OK.UseVisualStyleBackColor = true;
this.BT_OK.Click += new System.EventHandler(this.BT_OK_Click);
//
// BT_Canncel
//
this.BT_Canncel.Location = new System.Drawing.Point(251, 59);
this.BT_Canncel.Name = "BT_Canncel ";
this.BT_Canncel.Size = new System.Drawing.Size(75, 23);
this.BT_Canncel.TabIndex = 3;
this.BT_Canncel.Text = " [Esc]取消 ";
this.BT_Canncel.UseVisualStyleBackColor = true;
this.BT_Canncel.Click += new System.EventHandler(this.BT_Canncel_Click);
//
// MsgBox
//
this.AutoScaleBaseSize