📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Tools;
namespace Test
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private Tools.TextBoxExt textBoxExt1;
private Tools.TextBoxExt textBoxExt3;
private Tools.TextBoxExt textBoxExt2;
private Tools.TextBoxExt textBoxExt4;
private Tools.TextBoxExt textBoxExt5;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.textBoxExt1 = new Tools.TextBoxExt();
this.textBoxExt3 = new Tools.TextBoxExt();
this.textBoxExt2 = new Tools.TextBoxExt();
this.textBoxExt4 = new Tools.TextBoxExt();
this.textBoxExt5 = new Tools.TextBoxExt();
this.SuspendLayout();
//
// textBoxExt1
//
this.textBoxExt1.AllowSpace = false;
this.textBoxExt1.ChoicOnly = false;
this.textBoxExt1.ForeColor = System.Drawing.SystemColors.InfoText;
this.textBoxExt1.Location = new System.Drawing.Point(32, 24);
this.textBoxExt1.Name = "textBoxExt1";
this.textBoxExt1.PromptBackColor = System.Drawing.SystemColors.Info;
this.textBoxExt1.PromptBordrStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.textBoxExt1.PromptForColor = System.Drawing.SystemColors.InfoText;
this.textBoxExt1.TabIndex = 2;
this.textBoxExt1.Text = "textBoxExt1";
//
// textBoxExt3
//
this.textBoxExt3.AllowSpace = false;
this.textBoxExt3.ChoicOnly = false;
this.textBoxExt3.Location = new System.Drawing.Point(152, 64);
this.textBoxExt3.Name = "textBoxExt3";
this.textBoxExt3.PromptBackColor = System.Drawing.SystemColors.Info;
this.textBoxExt3.PromptBordrStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.textBoxExt3.PromptForColor = System.Drawing.SystemColors.InfoText;
this.textBoxExt3.TabIndex = 3;
this.textBoxExt3.Text = "textBoxExt3";
//
// textBoxExt2
//
this.textBoxExt2.AllowSpace = false;
this.textBoxExt2.ChoicOnly = false;
this.textBoxExt2.Location = new System.Drawing.Point(160, 24);
this.textBoxExt2.Name = "textBoxExt2";
this.textBoxExt2.PromptBackColor = System.Drawing.SystemColors.Info;
this.textBoxExt2.PromptBordrStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.textBoxExt2.PromptForColor = System.Drawing.SystemColors.InfoText;
this.textBoxExt2.TabIndex = 4;
this.textBoxExt2.Text = "textBoxExt2";
//
// textBoxExt4
//
this.textBoxExt4.AllowSpace = false;
this.textBoxExt4.ChoicOnly = false;
this.textBoxExt4.Location = new System.Drawing.Point(152, 104);
this.textBoxExt4.Name = "textBoxExt4";
this.textBoxExt4.PromptBackColor = System.Drawing.SystemColors.Info;
this.textBoxExt4.PromptBordrStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.textBoxExt4.PromptForColor = System.Drawing.SystemColors.InfoText;
this.textBoxExt4.TabIndex = 5;
this.textBoxExt4.Text = "textBoxExt4";
//
// textBoxExt5
//
this.textBoxExt5.AllowSpace = false;
this.textBoxExt5.ChoicOnly = false;
this.textBoxExt5.Location = new System.Drawing.Point(152, 144);
this.textBoxExt5.Name = "textBoxExt5";
this.textBoxExt5.PromptBackColor = System.Drawing.SystemColors.Info;
this.textBoxExt5.PromptBordrStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.textBoxExt5.PromptForColor = System.Drawing.SystemColors.InfoText;
this.textBoxExt5.TabIndex = 6;
this.textBoxExt5.Text = "textBoxExt5";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.textBoxExt5);
this.Controls.Add(this.textBoxExt4);
this.Controls.Add(this.textBoxExt2);
this.Controls.Add(this.textBoxExt3);
this.Controls.Add(this.textBoxExt1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
//创建一个数组,用于填充本控件的可选项
ArrayList arr=new ArrayList();
arr.Add("aaabbbcccddd");
arr.Add("bbbcccdddeee");
arr.Add("cccdddeeefff");
arr.Add("dddeeefffggg");
arr.Add("234567");
//遍历所有控件,筛选出增强型文本框控件进行可选项赋值
foreach(Control ctl in this.Controls)
{
TextBoxExt txtbox=ctl as TextBoxExt;
if(txtbox==null)
continue;
txtbox.ChoiceArray=arr;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -