Ole,
Well, the compiler error is pretty explicit. Did you look in the
designer generated code? My guess is that is where you will find the method
that the designer created.
If you are storing these pens, and want to get rid of them when
disposing, then I would modify that method to dispose of your pens.
If modifying designer-generated code doesn't sound like a great idea to
you, you could create a class which derives from Component, and then add
that to your form. Then, on that component, you would have an Add method
which would take an IDisposable reference, and in that component's dispose
method, you would cycle through and call Dispose on whatever was added
(which you have to keep a list of internally, of course).

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>I have created an user control (that inherits UserControl) in which I have
>defined an override on the Dispose member like this:
[quoted text clipped - 19 lines]
> Thanks
> Ole
Ole - 25 Oct 2007 19:04 GMT
Hi Nicholas,
You're absolutely right - why didn't I figure that out - well thanks for
your help!
BR
Ole
> Ole,
>
[quoted text clipped - 35 lines]
>> Thanks
>> Ole