Hi,
See my articles:
HOWTO: Add a control to a Windows form from a Visual Studio add-in
http://www.mztools.com/Articles/2006/MZ016.htm
HOWTO: Manipulating controls of Windows forms from Visual Studio .NET
add-ins
http://www.mztools.com/articles/2005/MZ001.htm

Signature
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
>I have a package that needs to add a set of images to an ImageList on a
> form in the current project. This would involve updating the
[quoted text clipped - 4 lines]
> the code model and it would be a nightmare trying to update the
> ImageStream properties directly.
slush_puppy - 20 Apr 2006 17:05 GMT
Thanks Carlos, those are both great articles. Your whole collection of
articles is very impressive.
The suggestions got me 90% of the way there. When I get to the
ImageList's Images property descriptor, it's value is of type
System.Windows.Forms.Design.ImageListDesigner. This must be private or
internal class because there's no way to declare a variable of that
type (I get an "inaccessible due to its protection level" error when
compiling).
So I've gotten to the property, I just can't get or set the value.
Here's my code:
// get the Windows Form designer
designerHost =
(System.ComponentModel.Design.IDesignerHost)designerHostObj;
// get the designer's control container
container = designerHost.Container;
// iterate over the components
foreach (IComponent component in container.Components)
{
// check if we've got the image list
if (component is ImageList)
{
PropertyDescriptorCollection pdc =
TypeDescriptor.GetProperties(component);
PropertyDescriptor pd = pdc["Images"];
string x = pd.GetValue(component).ToString();
}
}
It finds the image list and at the end if the if block, x =
"System.Windows.Forms.Design.ImageListDesigner+OriginalImageCollection"
Any idea where to go from here? Thanks again for the great help!
slush_puppy - 20 Apr 2006 17:50 GMT
Well, I made a little more progress here. I'm able to cast the value
to an IList. It's reporting the image count correctly, so that worked.
However, when I try to add an image, it throws an exception reporting:
System.ArgumentException was unhandled
Message: Parameter must be of type ImageListImage
Unfortunately, ImageListImage looks like another one of those private
or internal classes. I'm so close I can taste it! Any ideas?
Carlos J. Quintero [VB MVP] - 21 Apr 2006 10:39 GMT
For the internal classes / properties that are not accesible outside the
designer, try using Reflection. You can use Reflector .NET
(http://www.aisto.com/roeder/dotnet/) to see the internal implementation of
the designers to know what to send and why exceptions are raised.

Signature
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
> Well, I made a little more progress here. I'm able to cast the value
> to an IList. It's reporting the image count correctly, so that worked.
[quoted text clipped - 5 lines]
> Unfortunately, ImageListImage looks like another one of those private
> or internal classes. I'm so close I can taste it! Any ideas?