110,534
社区成员
发帖
与我相关
我的任务
分享
public string Text1
{
get{return this.textBox1.Text;}
set{ this.textBox1.Text=value;}
}
public static class HandlerManager
{
public static delegate TextChangedHandler(string value);
public static event TextChanged;
public static void TextChange(string value)
{
if(TextChanged != null)
{
TextChanged(value);
}
}
}
//Form2 加载事件监听
HandlerManager.TextChanged += delegate(string value)
{
this.TextBox2.Text=value;
};
//Form1 触发事件
HandlerManager.TextChange("文本框值改变了,你响应一下!");