C# inputBox文字输入对话框,类似delphi的inputBox
2011-04-26 15:31
537 查看
//inputbox输入函数 by 闫磊 Email:Landgis@126.com,yanleigis@21cn.com 2007.10.10 private string InputBox(string Caption, string Hint, string Default) { 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
- .net C# inputBox文字输入对话框,类似delphi的inputBox收藏
- C# inputBox文字输入对话框
- ClassInputBox类 在c#中类似VB的InputBox
- 扩展 delphi 泛型 以实现类似lambda功能 , C#中的any count first last 等扩展方法
- 艾伟_转载:C#下实现空白窗体上中文输入,可以实现类PS的文字工具
- 折腾了一早上的C# WPF ListView+Grid 实现图片+文字 自动换行排列 类似Windows资源管理器效果
- C#区分多态和重载-delphi也类似
- 用DELPHI、RxRichEdit控件实现类似QQ的表情输入方法
- 出现C#编辑后,窗口中的txetBox中无法输入文字
- WPF 之 实现TextBox输入文字后自动弹出数据(类似百度的输入框)
- WPF 之 实现TextBox输入文字后自动弹出数据(类似百度的输入框)
- Delphi to C# Equivalances--delphi和C#类似的地方
- delphi InputBox输入密码用*代替,怎样让delphi的inputbox输入框显示密码代表符*
- c#判断输入文字是否是数字
- delphi 文本框内容空白时加上提示文字,输入内容时提示文字不显示
- html5+css实现六位数字密码输入对话框(类似支付宝,微信)