frmdatainform2.cs
来自「用C#编的非常好的程序」· CS 代码 · 共 117 行
CS
117 行
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace winappFirst
{
/// <summary>
/// frmDataInForm2 的摘要说明。
/// </summary>
public class frmDataInForm2 : System.Windows.Forms.Form
{
public System.Windows.Forms.TextBox txtDataCh;
private System.Windows.Forms.Button btnOk;
// 用户定义
public string datafromp;
public frmDataInForm Tfrm=new frmDataInForm();
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public frmDataInForm2()
{
//
// 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.txtDataCh = new System.Windows.Forms.TextBox();
this.btnOk = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtDataCh
//
this.txtDataCh.Location = new System.Drawing.Point(56, 48);
this.txtDataCh.Name = "txtDataCh";
this.txtDataCh.Size = new System.Drawing.Size(240, 21);
this.txtDataCh.TabIndex = 0;
this.txtDataCh.Text = "";
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(376, 104);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(96, 32);
this.btnOk.TabIndex = 1;
this.btnOk.Text = "Ok";
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// frmDataInForm2
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(520, 157);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.txtDataCh);
this.Name = "frmDataInForm2";
this.Text = "frmDataInForm2";
this.Load += new System.EventHandler(this.frmDataInForm2_Load);
this.ResumeLayout(false);
}
#endregion
private void btnOk_Click(object sender, System.EventArgs e)
{
this.Tfrm.txtData.Text =txtDataCh.Text;
this.Close();
}
private void frmDataInForm2_Load(object sender, System.EventArgs e)
{
//txtDataCh.Text=this.datafromp;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?