Access the ComponentTray
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.windowsforms.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Joris Laperre (VIP)
Hi,

I'm writing an add-in that adds controls to a form at design time. I got
this working for visible controls on the form by getting an IDesignerHost for
the form, and adding to the Controls collection of the RootComponent, but
this doesn't work for components in the ComponentTray (I want to add an
ImageList). I suspect I need to call the Add method of the Controls
collection on the ComponentTray, but I don't know how to get to the
ComponentTray object for a Form or UserControl. Any ideas ?

Thanks in advance.

Cheers,
Joris
Reply to this message...
 
    
Iulian (VIP)
You actually need to use the CreateComponent() method of the IDesignerHost
that will automatically add the component where it needs to be added, e.g. if
it is a component that goes in the tray you will see it there. Similar to
remove one use DestroyComponent().

regards,
Iulian
http://www.olvio.com/

"Joris Laperre" wrote:

[Original message clipped]

Reply to this message...
 
    
Joris Laperre (VIP)
Hi Iulian,

That's exactly what I need. Thanks for your help.

Cheers,
Joris

"Iulian" wrote:

[Original message clipped]

Reply to this message...
 
 
System.ComponentModel.Design.IDesignerHost
System.Web.UI.UserControl
System.Windows.Forms.Design.ComponentTray
System.Windows.Forms.ImageList
System.Windows.Forms.UserControl




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com