View Single Post
  #1 (permalink)  
Old March 7th, 2007, 01:56 AM
bhavna bhavna is offline
Authorized User
 
Join Date: Jan 2007
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Event handling in c#


I have a class MyDataGrid which is inherited from Datagrid
which have two protected override functions.
i want to register the events.
for example
public class MyDataGrid : DataGrid

    {
        protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
    {
//dosomething
}
protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
//dosomething
}
Now i want to register these events
i m registering as
this.dataGrid1.MouseDown+=new System.Windows.Forms.MouseEventHandler(this.OnMous eDown);
this.dataGrid1.MouseMove+=new System.Windows.Forms.MouseEventHandler(this.OnMous eMove);

error is
 Method 'System.Windows.Forms.Control.OnMouseDown(System.W indows.Forms.MouseEventArgs)' does not match delegate 'void System.Windows.Forms.MouseEventHandler(object, System.Windows.Forms.MouseEventArgs)'
 Method 'System.Windows.Forms.Control.OnMouseMove(System.W indows.Forms.MouseEventArgs)' does not match delegate 'void System.Windows.Forms.MouseEventHandler(object, System.Windows.Forms.MouseEventArgs)'
can anybody tell me waht's the solution?
i m coding in C# Windows application ,version 1.1(2003)