通过委托实现窗体间通信

时间:2016-03-29 05:09:27
【文件属性】:
文件名称:通过委托实现窗体间通信
文件大小:30KB
文件格式:7Z
更新时间:2016-03-29 05:09:27
窗体间通信 通过委托实现窗体间通信 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Form1DelegateForm2 { /// /// 主窗体 /// public partial class Form1 : Form { public Form1() { InitializeComponent(); textBox1.Text = "演示文本"; } private void button1_Click(object sender, EventArgs e) { Form2 frm = new Form2(this.textBox1.Text); frm.myEvent += this.ModifyText; frm.ShowDialog(); } /// /// 让子窗体中的委托来调用 /// /// public void ModifyText(string s) { this.textBox1.Text = s; } } }
【文件预览】:
通过委托实现窗体间通信
----Form1DelegateForm2()
--------Form1DelegateForm2()
--------Form1DelegateForm2.sln(944B)
--------Form1DelegateForm2.v11.suo(29KB)

网友评论