教程集 www.jiaochengji.com
教程集 >  脚本编程  >  C语言  >  正文 C#里的InputBox

C#里的InputBox

发布时间:2019-01-28   编辑:jiaochengji.com
教程集为您提供C#里的InputBox等资源,欢迎您收藏本站,我们将为您提供最新的C#里的InputBox资源
在.NET Framework中并没有类似VB中的InputBox函数,虽然可以借助对VB 的Runtime引用,以在VB除外的.NET程序中使用VB的InputBox,但是为什么不自己写一个类实现类似的功能呢?
下面一个类实现了类似的InputBox函数的功能:
using System;
using System.Windows.Forms;

namespace Input
{
/// <summary>
/// clsInputBox 的摘要说明。
/// </summary>
public class InputBox : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox txtData;
private System.Windows.Forms.Label lblInfo;
private System.ComponentModel.Container components = null;

private InputBox()
{
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.SuspendLayout();
//
// txtData
//
this.txtData.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));

您可能感兴趣的文章:
C#里的InputBox
vbscript基础教程-判断结构
vbscript基础教程-什么是vbscript
vbs 多线程下载的代码举例
vbscript基础教程-变量、常量和基本运算
vbs整人代码-输入指定的话不然不关闭
vbscript基础教程-数组
vbs恶作剧(整人代码)-感人的文章(我是猪)
vbs整人代码-定时关机
添加程序到自启动项中的vbs脚本

[关闭]
~ ~