📄 form2.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace LoginDemo
{
/// <summary>
/// Form2 的摘要说明。
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox _txtuserinfo;
private System.Windows.Forms.Button _btnreturn;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form2()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
public string _name;
public Form2(string name)
{
InitializeComponent();
_name=name;
}
public Form1 f11;
public Form2(Form1 f1)
{
f11=f1;
InitializeComponent();
// this._txtuserinfo.Text=f1._txtName.Text;
}
/// <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.label1 = new System.Windows.Forms.Label();
this._txtuserinfo = new System.Windows.Forms.TextBox();
this._btnreturn = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(80, 40);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "欢迎光临";
//
// _txtuserinfo
//
this._txtuserinfo.Location = new System.Drawing.Point(80, 80);
this._txtuserinfo.Name = "_txtuserinfo";
this._txtuserinfo.ReadOnly = true;
this._txtuserinfo.TabIndex = 1;
this._txtuserinfo.Text = "";
//
// _btnreturn
//
this._btnreturn.Location = new System.Drawing.Point(96, 128);
this._btnreturn.Name = "_btnreturn";
this._btnreturn.TabIndex = 2;
this._btnreturn.Text = "返回";
this._btnreturn.Click += new System.EventHandler(this._btnreturn_Click);
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this._btnreturn);
this.Controls.Add(this._txtuserinfo);
this.Controls.Add(this.label1);
this.Name = "Form2";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "主窗体";
this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false);
}
#endregion
private void _btnreturn_Click(object sender, System.EventArgs e)
{
this.Visible=false;
Form1 f1=new Form1();
f1.Show();
}
private void Form2_Load(object sender, System.EventArgs e)
{
// this._txtuserinfo.Text=this._name;
this._txtuserinfo.Text=f11._txtName.Text;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -