日期:2014-05-18 浏览次数:20993 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public void renovate()
{
//刷新的代码
}
}
}
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form2 : Form { private Form1 _MyForm1 = new Form1(); public Form1 MyForm1 { get { return _MyForm1; } set { _MyForm1 = value; } } public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //回调Form1的刷新事件 _MyForm1.Invoke(new Action(_MyForm1.renovate)); //更多的操作可以看看Invoke的详细资料,也可以看看多线程之间的通信资料 } } }