.net C# inputBox文字输入对话框,类似delphi的inputBox收藏
2008-09-12 22:30
417 查看
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();
}
}
...{
//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();
}
}
相关文章推荐
- .net C# inputBox文字输入对话框,类似delphi的inputBox
- .net C# inputBox文字输入对话框,类似delphi的inputBox
- .net C# inputBox文字输入对话框,类似delphi的inputBox
- .net C# inputBox文字输入对话框,类似delphi的inputBox
- C# inputBox文字输入对话框,类似delphi的inputBox
- VC下在对话框上直接输入字母或文字的实现 (Input word on CDialog directly)
- delphi InputBox输入密码用*代替,怎样让delphi的inputbox输入框显示密码代表符*
- .net C# listbox的key和Text分离,类似delphi的listbox的Data
- 输入文字自动筛选--类似百度的功能(onchange与oninput和 onpropertychange 两者的区别)
- C# inputBox文字输入对话框
- 基于C#.NET Remoting技术的全球文字聊天室
- 直接调用内置数据源连接对话框(C#/VB.NET2005源码)
- 每日学习心得:CustomValidator验证控件验证用户输入的字符长度、Linq 多字段分组统计、ASP.NET后台弹出confirm对话框,然后点击确定,执行一段代码
- cocos2dx 2.x EditBox在6s plus下看不到输入文字的解决方案
- asp.net C# 调用 delphi的dll
- 扩展 delphi 泛型 以实现类似lambda功能 , C#中的any count first last 等扩展方法
- 多线程:C#.NET中使用BackgroundWorker在模态对话框中显示进度条
- C# ASP.NET中无刷新页面 弹出对话框,并且页面跳转
- 使用ASP.net(C#)批量上传图片并自动生成缩略图,文字水印图,图片水印图
- C#.net picturebox动画效果,刷新图像的闪烁问题解决方法