I am trying to set winform OnMouseDown event to a method I defined called SelectMouseDown.
The method is defined as follows:
method Maker.SelectMouseDown(Sender: Object; e: System.Windows.Forms.MouseEventArgs);
and I am trying to do the following:
OnMouseDown += System.Windows.Forms.MouseEventHandler(@Self.SelectMouseDown);
The compiler throws the following error message: "There is no overloaded method "OnMouseDown" with 0 parameters."
What am I doing wrong? How do you set events during runtime?
Thanks in advance,
You forgot
new
, and the event is namedMouseDown
as Marc Gravell pointed out:I don't know about Delphi, but in C# the compiler can create the delegate automatically: