如何:实现使用后台操作的窗体
如何:实现使用后台操作的窗体
http://msdn2.microsoft.com/zh-cn/library/waw3xexc(VS.80).aspx
http://msdn2.microsoft.com/zh-cn/library/8xs8549b.aspx
还有一中方法,在辅助线程中这样写:
public delegate void AuthHandler(bool authValue);//托管类型
................................................................................
private void AuthUser_Check(bool isLogin)
{
if (this.InvokeRequired)
{
AuthHandler au = new AuthHandler(AuthUser_Check);
this.Invoke(au, new object[] { isLogin });
}
else
{
this.mf = new MainForm();
mf.Show();
this.Hide();
}
}
然后线程中调用该方法,不过建议用BeginInvoke方法,因为是异步的
http://msdn2.microsoft.com/zh-cn/library/waw3xexc(VS.80).aspx
http://msdn2.microsoft.com/zh-cn/library/8xs8549b.aspx
还有一中方法,在辅助线程中这样写:
public delegate void AuthHandler(bool authValue);//托管类型
................................................................................
private void AuthUser_Check(bool isLogin)
{
if (this.InvokeRequired)
{
AuthHandler au = new AuthHandler(AuthUser_Check);
this.Invoke(au, new object[] { isLogin });
}
else
{
this.mf = new MainForm();
mf.Show();
this.Hide();
}
}
然后线程中调用该方法,不过建议用BeginInvoke方法,因为是异步的

浙公网安备 33010602011771号