Can a custom event be created for any object method?
To do this do I just use the following syntax?:
myObject.myMethod +=new EventHandler(myNameEvent);
The following code has prompted this question:
private void btRunProcessAndRefresh_Click(object sender,EventArgs e)
{
myProcess =new Process();
myProcess.StartInfo.FileName = @"c:ConsoleApplication4.exe";
myProcess.Exited += new EventHandler(MyProcessExited);
myProcess.EnableRaisingEvents =true;
myProcess.SynchronizingObject =this;
btRunProcessAndRefresh.Enabled =false;
myProcess.Start();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…