C# inputBox文字输入对话框
2010-06-30 20:54
381 查看
private string InputBox(string Caption, string Hint, string Default)
...{
//by 闫磊 Email:Landgis@126.com,yanleigis@21cn.com 2007.10.10
Form InputForm = new Form();
InputForm.MinimizeBox = false;
InputForm.MaximizeBox = false;
InputForm.StartPosition = FormStartPosition.CenterScreen;
InputForm.Width = 220;
InputForm.Height = 150;
//InputForm.Font.Name = "宋体";
//InputForm.Font.Size = 10;
InputForm.Text = Caption;
Label lbl = new Label();
lbl.Text = Hint;
lbl.Left = 10;
lbl.Top = 20;
lbl.Parent = InputForm;
lbl.AutoSize = true;
TextBox tb = new TextBox();
tb.Left = 30;
tb.Top = 45;
tb.Width = 160;
tb.Parent = InputForm;
tb.Text = Default;
tb.SelectAll();
Button btnok = new Button();
btnok.Left = 30;
btnok.Top = 80;
btnok.Parent = InputForm;
btnok.Text = "确定";
InputForm.AcceptButton = btnok;//回车响应
btnok.DialogResult = DialogResult.OK;
Button btncancal = new Button();
btncancal.Left = 120;
btncancal.Top = 80;
btncancal.Parent = InputForm;
btncancal.Text = "取消";
btncancal.DialogResult = DialogResult.Cancel;
try
...{
if (InputForm.ShowDialog() == DialogResult.OK)
...{
return tb.Text;
}
else
...{
return null;
}
}
finally
...{
InputForm.Dispose();
}
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yanleigis/archive/2007/10/10/1818268.aspx
...{
//by 闫磊 Email:Landgis@126.com,yanleigis@21cn.com 2007.10.10
Form InputForm = new Form();
InputForm.MinimizeBox = false;
InputForm.MaximizeBox = false;
InputForm.StartPosition = FormStartPosition.CenterScreen;
InputForm.Width = 220;
InputForm.Height = 150;
//InputForm.Font.Name = "宋体";
//InputForm.Font.Size = 10;
InputForm.Text = Caption;
Label lbl = new Label();
lbl.Text = Hint;
lbl.Left = 10;
lbl.Top = 20;
lbl.Parent = InputForm;
lbl.AutoSize = true;
TextBox tb = new TextBox();
tb.Left = 30;
tb.Top = 45;
tb.Width = 160;
tb.Parent = InputForm;
tb.Text = Default;
tb.SelectAll();
Button btnok = new Button();
btnok.Left = 30;
btnok.Top = 80;
btnok.Parent = InputForm;
btnok.Text = "确定";
InputForm.AcceptButton = btnok;//回车响应
btnok.DialogResult = DialogResult.OK;
Button btncancal = new Button();
btncancal.Left = 120;
btncancal.Top = 80;
btncancal.Parent = InputForm;
btncancal.Text = "取消";
btncancal.DialogResult = DialogResult.Cancel;
try
...{
if (InputForm.ShowDialog() == DialogResult.OK)
...{
return tb.Text;
}
else
...{
return null;
}
}
finally
...{
InputForm.Dispose();
}
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yanleigis/archive/2007/10/10/1818268.aspx
相关文章推荐
- .net C# inputBox文字输入对话框,类似delphi的inputBox
- .net C# inputBox文字输入对话框,类似delphi的inputBox
- .net C# inputBox文字输入对话框,类似delphi的inputBox
- C# inputBox文字输入对话框,类似delphi的inputBox
- .net C# inputBox文字输入对话框,类似delphi的inputBox
- .net C# inputBox文字输入对话框,类似delphi的inputBox收藏
- c#中输入文本文字,将输入的文字生成图片
- c#判断输入文字是否是数字
- 文字服务和输入语言检测到不兼容的键盘驱动程序该对话框已被停用!解决方法
- c#判断输入文字是否是数字
- C#实现VB6.0的输入窗体InputBox代码
- 各种对话框的实现(文字对话框,选择对话框,弹出输入对话框,单选,多选对话框,自定义对话框)
- c#判断输入文字是否是数字
- 艾伟_转载:C#下实现空白窗体上中文输入,可以实现类PS的文字工具
- c#判断输入文字是否是数字
- c#判断输入文字是否是数字(转)
- c#判断输入文字是否是数字
- VC下在对话框上直接输入字母或文字的实现 (Input word on CDialog directly)
- C#下实现空白窗体中文输入,实现类PS的文字工具
- 出现C#编辑后,窗口中的txetBox中无法输入文字