-
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
Jacques Bourgeois
JBFI
http://www3.sympatico.ca/jbfi/homeus.htm
-
Thanks for your reply, but i solved my problem just right now.
I have remove the contructor created by designer
"'<System.Diagnostics.DebuggerNonUserCode()> _
'Public Sub New(ByVal container As System.ComponentModel.IContainer)
' MyClass.New()
' 'Required for Windows.Forms Class Composition Designer support
' If (container IsNot Nothing) Then
' container.Add(Me)
' End If
'End Sub"
And i create a Designer for ActionsManager:
Imports System.ComponentModel.Design
Public Class ActionsManagerDesigner
Inherits ComponentDesigner
Public Overrides ReadOnly Property AssociatedComponents As System.Collections.ICollection
Get
Dim manager As ActionsManager = CType(Me.Component, ActionsManager)
If manager Is Nothing Then Return MyBase.AssociatedComponents
Dim controls As New ArrayList()
controls.AddRange(manager.Actions)
Return controls
End Get
End Property
End Class
When i create an ActionHander object i'm adding this to ActionManager Components.
I've got exactly what i want.
Similar Threads
-
By wrappingduke in forum Mobile
Replies: 0
Last Post: 02-02-2009, 03:24 PM
-
By eldiener in forum .NET
Replies: 0
Last Post: 01-17-2007, 10:38 PM
-
By Michael Sorens in forum XML
Replies: 0
Last Post: 12-11-2002, 06:05 PM
-
Replies: 0
Last Post: 08-27-2000, 07:56 AM
-
By Lim Wing Hoe in forum Java
Replies: 0
Last Post: 07-16-2000, 04:49 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|