[IronPython] Problem binding delegate to Form.Paint

Curt Hagenlocher curt at hagenlocher.org
Wed Sep 1 15:10:20 CEST 2004

Brian Quinlan <brian at sweetapp.com> writes:

> def paint(data, event):
>      pass
> f.Paint += paint
> Unhandled Exception: System.ArgumentException: Error binding to
> target method.
> [...]
> Does anyone understand this problem?

The PaintEventHandler delegate has a signature that is not compatible
with the EventHandler delegate, which is the only one supported
"out-of-the-box" by IronPython.  I posted a patch in the last two
weeks that would allow your code to work.  You can find it in the

I'm in the middle of figuring out how to handle virtual methods in
overriding a CLR base class, or I'd repost the code.  When I'm done,
you'll be able to say

class MyForm(Form):

Curt Hagenlocher
curt at hagenlocher.org

More information about the Ironpython-users mailing list