form and support some kind of dictionary {ComponentName -> Pointer} in it.
You can serialize the dictionary and thus use it at runtime. At design time
Component-Added/Removed/Rename must be handled. You can even recreate
the dictionary in EndInit() of the form or when the form is persisted.
"Frank Hileman" <frankhil@no.spamming.prodigesoftware.com> wrote in message news:<ue$V6LIVEHA.3336@TK2MSFTNGP11.phx.gbl>...
> Hello Don,
>
> You wish to obtain this information at design-time, correct? At run-time
> there is no reliable way to obtain this information. There is no way to
> obtain the name either, if it is not serialized as a property in the
> Component, as with Control. The only way to do this is via reflection on
> members, and you are making a lot of assumptions if you start doing that.
> That is, which fields were added by the designer, and which fields were
> added outside the designer? How can you know?
>
> If all your Component-derived classes have a Name property, then it will be
> used both at design and run-time, and will be serialized and available at
> run-time. But you cannot change classed created by other authors, to force
> them to serialize a name.
>
> At design-time, if you derive from Component you have a Container property
> that should list all components known to the root designer. That includes
> controls as well as components in the component tray.
>
> Regards,
> Frank Hileman
>
> check out VG.net:
www.vgdotnet.com > Animated vector graphics system
> Integrated Visual Studio .NET graphics editor
>
> "Don Munroe" <dmunroe@cdhsystems.com> wrote in message
> news:%23DJr97GVEHA.2508@TK2MSFTNGP12.phx.gbl...
> > Hello all,
> >
> > I've searched around and can't seem to find a solution to this. I
> have
> > a component that builds a tree of controls / components that are placed on
> a
> > form. The walking the controls was easy and is working great. The
> problem
> > is the components in the ComponentTray. I've added multiple Save File
> > Dialogs, Open File Dialogs, Font Dialogs, etc...
> >
> > When I create an instance of the component tray, the only component
> > listed is my custom component because I added a constructor that takes
> > IContainer as a parameter.
> >
> > Does anyone have any idea how I can get the list of components in the
> > ComponentTray regardless of whether or not it has a IContainer
> constructor.
> >
> > I've also found out that the components name property isn't available
> at
> > run time, this could lead to other problems, so if any one has an idea for
> > that it would be greatly appreciated.
> >
> > Don Munroe
> >