Picking & Choosing controls from the Form collection to add to another collection

Denaes

Senior Contributor
Joined
Jun 10, 2003
Messages
956
It sounds complicated, but it's hard to explain in a single line.

I'm creating a control and I want to create a property that will allow me to add multiple (as few as zero and as many as all in an extreme case) controls to a ControlCollection, ArrayList or Collection in my custom control.

When you click on the property, I want a dropdown to popup and possibly look like a checked listbox with all of the controls... or maybe just have a window come up with a listbox full of Controls on screen and Controls added (or to add to) the control.

I've seen similar functionality in a few components. A bindingsource (2005) has a dropdown menu to select from a list of datasources (though it only lets you choose one). A stripcontrol and listbox both let you add new items in a new window. Rather than adding new items, I'm looking to add existing items.

I have no problem getting my result via code with an addControl property. It passes the control in and I add it to the collection on the other side.

I'm not asking anyone to do this for me, but I'm not sure exactly where to start to get these specialized windows from properties. I googled for about 15 minutes on it and got nowhere. I just don't know the area to target my searches.
 
I felt so close!

Using Control as a datatype for the property gets you a list of all of the controls on the form... but using ControlCollection or Control() (an array) gets you a popup window where you can build your own custom controls for the collection/array.

Actually, it wouldn't bother me in the least having a Form popup just after you add the window to the form.

The window would show the ControlCollection of the parent form in a checked listbox. Those that are checked exist in the controls ControlCollection.

Then there would be another three properties to set at this time. And possibly have this window pop back up either by way of a button only existing at runtime, a context menu, those little triangle thingies in the upper corner (in 2005) or a property.

So at this point, if someone can explain it how to make a form popup from a form being dragged onto a control and/or how to create runtime functionality. Most likely I assume someone might know a tutorial or at least the keywords so I can continue my search and relay my findings here :D
 
Last edited:
Back
Top