
Need help with property window for my new form class
Are you looking to create a collection as a member of a your custom control,
add controls to the collection at design-time and edit their properties in
the collection editor? I hope I get you predicament . . . .
I would . . .
a) create a new object called "MyMember" with one property called
"Component" (of type say IComponent)
b) create a strongly typed collection class called "MyMembers" which stores
only MyMember objects (above)
Now the custom collection editor will allow you to add MyMember object to
the MyMembers collection. Once this is done the "Component" property of the
new member should be able to be dropped down and any component on the form
(anything derived from IComponent) should be able to be selected as the
component. What you MyMember class does after that is up to you.
Hope this helps.
BigDave, Sydney Australia
Quote:
> Hello,
> I have designed a class that inherits from the base form class
> (System.Windows.Forms.Form). One of the things that I need to implement
> is to be able to associate, at design time, controls to a string. My
> thought is that I need to create a class that implements IList and
> ICollection and contains objects of another class that I will need to
> create that just holds the string and the control.
> My problem is, I've looked at an example from
> http://www.codeproject.com/useritems/ImageListBox.asp that shows how to
> implement a collection that can be edited at design time, but I'm not
> sure how to handle the controls. I can't seem to reference them ByRef in
> a property and I don't know how to provide the ability to select from
> *existing* controls on the form in the property editor for the
> collection. Also, I would *really* like to avoid writing my own property
> editor.
> Can anyone give me some advice or point me to an example of this? If
> it's in VB.NET that would be even better. The example mentioned above is
> in C#, which I can decipher, but I've never used C# and it's been a few
> years since C++.
> Thanks!
> -Tom.