form1.cs
来自「Sams Teach Yourself C# Web Programming i」· CS 代码 · 共 116 行
CS
116 行
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Traditional_Controls
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class fclsControls : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblMyLabel;
private System.Windows.Forms.TextBox txtMyTextBox;
private System.Windows.Forms.TextBox txtRestrict;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public fclsControls()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblMyLabel = new System.Windows.Forms.Label();
this.txtMyTextBox = new System.Windows.Forms.TextBox();
this.txtRestrict = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// lblMyLabel
//
this.lblMyLabel.AutoSize = true;
this.lblMyLabel.Location = new System.Drawing.Point(5, 6);
this.lblMyLabel.Name = "lblMyLabel";
this.lblMyLabel.Size = new System.Drawing.Size(127, 13);
this.lblMyLabel.TabIndex = 0;
this.lblMyLabel.Text = "Labels are for static text!";
//
// txtMyTextBox
//
this.txtMyTextBox.Location = new System.Drawing.Point(128, 4);
this.txtMyTextBox.Multiline = true;
this.txtMyTextBox.Name = "txtMyTextBox";
this.txtMyTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtMyTextBox.Size = new System.Drawing.Size(136, 60);
this.txtMyTextBox.TabIndex = 1;
this.txtMyTextBox.Text = "This is sample text. A multiline text box will wrap its contents as necessary.";
//
// txtRestrict
//
this.txtRestrict.Location = new System.Drawing.Point(128, 80);
this.txtRestrict.MaxLength = 10;
this.txtRestrict.Name = "txtRestrict";
this.txtRestrict.PasswordChar = '*';
this.txtRestrict.Size = new System.Drawing.Size(136, 20);
this.txtRestrict.TabIndex = 2;
this.txtRestrict.Text = "";
//
// fclsControls
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.txtRestrict,
this.txtMyTextBox,
this.lblMyLabel});
this.Name = "fclsControls";
this.Text = "Traditional Controls Example";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new fclsControls());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?