Custom Component that contains Components
I'm using vb2010.
I have a component (ActionsManager) with a Collection of components (ActionHandler) property. I want the ActionsManager to be the Container for ActionHandlers, not the Form. And in the Document Outline window, ActionHandlers to be displayed under the ActionsManager, like controls under the Form. How can i do this?
Thank's in advance!
The Document outline provides a way to see the relation between a Container control and its child controls. It has been designed to show the hierarchy between controls, not components.
Since a Component is not a Container, neither a Control, you cannot use it to do what you want to do.
In order to see a hierarchy between your 2 classes in the Document Outline, ActionsManager needs to be a Control that has been designed as a container, either by inheriting from a Control that is already a Container (creating a UserControl instead of a Component might be the easiest solution here), or by implementing the IContainerControl interface (if you know what an interface is).
Then, ActionHandler should be a Control.
Since they are designed as controls, they will appear on the Form instead of in the components tray. You would simply have to drag the ActionHandlers onto the ActionsManager, and then maybe set the ActionsManager to a size of 0,0 so that it does not show on the form. That would not be a very good design idea, since a Control is usually something that is visible, but it would enable you to do what you want, simply by adding the a
Thanks for your reply, but i solved my problem just right now.
I have remove the contructor created by designer
'Public Sub New(ByVal container As System.ComponentModel.IContainer)
' 'Required for Windows.Forms Class Composition Designer support
' If (container IsNot Nothing) Then
' End If
And i create a Designer for ActionsManager:
Public Class ActionsManagerDesigner
Public Overrides ReadOnly Property AssociatedComponents As System.Collections.ICollection
Dim manager As ActionsManager = CType(Me.Component, ActionsManager)
If manager Is Nothing Then Return MyBase.AssociatedComponents
Dim controls As New ArrayList()
When i create an ActionHander object i'm adding this to ActionManager Components.
I've got exactly what i want.
By wrappingduke in forum Mobile
Last Post: 02-02-2009, 03:24 PM
By eldiener in forum .NET
Last Post: 01-17-2007, 10:38 PM
By Michael Sorens in forum XML
Last Post: 12-11-2002, 06:05 PM
Last Post: 08-27-2000, 07:56 AM
By Lim Wing Hoe in forum Java
Last Post: 07-16-2000, 04:49 AM
Tags for this Thread
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL