Patrick De Ridder said:
Do I understand correctly that you are saying that a Control can only
be placed on an existing Form? (I.e., you have the Form in the
Designer and you drag a Control onto it).
That's what I'm saying. I've only written a few controls, and am not an
expert on them, but my understanding is that a control's purpose in life is
to be added to a form (windows and/or web).
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemwindowsforms.htm
Note that you don't strictly _have_ to drag a control onto a form. Code
such as Michael Culley showed should work too:
this.controls.add (usc);
or perhaps more like this:
Form aForm = new Form();
aForm.Controls.Add(new MyControl());
My question then is: What then, is the function for, in the IDE, that
enables you to create a stand-alone Control, if a Control cannot live
a separate life?
I'm not entirely sure what you mean by stand-alone control. Do you mean a
"User Control"? Those are generally used for grouping other controls into
one unit that you can re-use. For instance, you may want a control with a
label, a textbox, and a button that you can use again and again on forms to
provide that combined functionality of the three other controls, without
having to explictly place each of the three. There are many other, much
more powerful uses.
If you've made a control you want to show by itself, you could probably put
it on a form with no title bar, no border, and make the control fill the
entire area.
Hope that helps clear up some issues. I may be wrong on some of this, as
this is only my understanding. I haven't been able to find anything in the
documentation to support this (only hints such as the above ms-help link).