能力值:
( LV4,RANK:50 )
|
-
-
2 楼
public partial class Form2 : Form
{
Form1 _frm;
public Form2()
{
InitializeComponent();
}
public Form2(Form1 frm):this()
{
_frm = frm;
}
private void button1_Click(object sender, EventArgs e)
{
_frm.textBox1.Text = this.textBox1.Text;
}
}
|
能力值:
( LV7,RANK:100 )
|
-
-
3 楼
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private void button1_Click(object sender, System.EventArgs e)
{
Form2 form = new Form2();
form.SendValueHandler+=new WindowsApp.Form2.SendValue(form_SendValueHandler);
form.Show();
}
private void form_SendValueHandler(string strValue)
{
MessageBox.Show(strValue);
}
}
public class Form2 : System.Windows.Forms.Form
{
public delegate void SendValue(string strValue);
public event SendValue SendValueHandler;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private void button1_Click(object sender, System.EventArgs e)
{
if(SendValueHandler != null)
{
SendValueHandler(this.textBox1.Text);
}
}
}
|
能力值:
( LV2,RANK:10 )
|
-
-
4 楼
2楼的好,就是这样
|
能力值:
( LV7,RANK:100 )
|
-
-
5 楼
100个窗体呢?
|
能力值:
( LV2,RANK:10 )
|
-
-
6 楼
两个方法都不错,不同场合用的不一样,谢谢大家了
|
|
|