namespace XtremeDotNet
{
#region Using Directives
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
#endregion
#region Delegates
public delegate void MyEventHandler(MyEventArgs e);
#endregion
public class MyForm: System.Windows.Forms.Form
{
public event MyEventHandler myEvent;
//Constructor
//Form Designer Code
#region Event Handlers
protected void OnMyEvent(MyEventArgs e)
{
if (this.myEvent != null)
this.myEvent(e);
}
#endregion
private void MyForm_SomeButtonClicked(object sender, EventArgs e)
{
this.OnMyEvent(new MyEventArgs("hi"));
}
}
public class MyEventArgs: EventArgs
{
using System;
private string text;
public string Text
{
get
{
return this.text;
}
set
{
this.text = value;
}
}
public MyEventArgs(string text)
{
this.text = text;
}
}
}