While this can be helpful in some circumstances (especially if you
are building a custom con-
trol that derives from a standard control), you will often handle events using the standard C# event
syntax (in fact, this is the default behavior of the Visual Studio designers). When you handle events
in this manner, the framework will call your custom event handler once the parent’s implementa-
tion has completed. For example, here is how you can manually handle the MouseDown event:
public partial class MainWindow : Form
{
public MainWindow()
{
MouseDown += new MouseEventHandler(MainWindow_MouseDown);
}
private void MainWindow_MouseDown(object sender, MouseEventArgs e)
{
Do'stlaringiz bilan baham: