TheSwamp

Code Red => .NET => Topic started by: Keith™ on April 17, 2020, 09:36:01 AM

Title: Sublclassing ControlCollection
Post by: Keith™ on April 17, 2020, 09:36:01 AM
I am attempting to build a control that I have needed for a very long time because I have not been able to find something suitable.
I am trying to create a flyout button (yeah, I thought there would be one) that can be expanded horizontally or vertically.
I've got a rudimentary version working, but I want to limit the ability to add controls to three specific types that are subclassed button, label and separator.
For now, everything else needs to be filtered out, but I can't filter them if I can't override the add method of ControlCollection .. and when I attempt to subclass ControlCollection I get an error that ControlCollection does not contain a constructor that takes 0 arguments ..

I've tried with default constructors zero arguments and every argument value in between. No dice.

Should I just give up this idea?
Title: Re: Sublclassing ControlCollection
Post by: Keith™ on April 17, 2020, 10:34:31 AM
Ok, it seems I just answered my own question … just capture the ControlAdded event on the usercontrol and dispose of it if it isn't what I need.
inefficient, but effective.