Jeff - yes. when i relocate my usercontrol (at runtime or design) the
controls i added to it are attached .
Joey - it sounds rather complicated. and im not sure it's possible (although
i didnt try)
as a solution i can always do it all as a component which inherit a panel
and so on... i think it should work but needs a lot more background work
without inheriting the usercontrol...
it's pity the usercontrol is so poor, rather nice potential.
by the way, does anyone knows the design attributes that can help me decides
which controls the user can add on design time to a container (ie panel) and
which he cant ?
thanks.
> Joey - it sounds rather complicated. and im not sure it's possible (although
> i didnt try)
> as a solution i can always do it all as a component which inherit a panel
> and so on... i think it should work but needs a lot more background work
> without inheriting the usercontrol...
I was able to replicate the .NET TabControl with buttons to click on and
panels as detail where user can drag controls into. Btw: WinForm controls
including panel is already a component. The idea is to create the control
from IDesignerHost so it is present on the container surface at design time.
http://www.divil.co.uk/net/articles/designers/collectioncontrols.asp
> by the way, does anyone knows the design attributes that can help me decides
> which controls the user can add on design time to a container (ie panel) and
> which he cant ?
You should attach a custom designer to your custom panel control inheriting
from ParentControlDesigner and then override the CanParent method...
Alon - 21 Oct 2004 19:59 GMT
hi,
10X for the "CanParent" tip, i solved it through overriding the
"OnControlAdded" method. which is better way to do it ?
and regarding my base problem, i kind of got to the next phase - i now have
a usercontrol of type "A" who can hold lots of usercontrols of type "B". if
i drag the "A" and then drag the "B" into "A" i CAN add other controls to
"B". that was my initial meaning !!!
BUT, while this situation is ok, i rather want "A" to have a collection
property of "B"s (like tabcontrol with tabpages etc) with all "B"'s
properties.
this cause me 2 problems:
1) i understood i need a collection class and an item class and lots of
other stuff. is there a good article/code example anywhere about it ? couldnt
find any that is really thorough... (Joey - i already saw the article you
attached, 10X a lot but this example do not really take care all the aspects
i need, although when read it, i started to understand what is waiting for
me....:))
2) i kind of succeeded in doing something like a collection (simple property
who makes on design time "B" and add it to "A") but then i couldnt see it on
the "InitializeComponent" methode of the main form, in other words - i
couldnt add to "B" other controls...
i figure that if problem 1 will be solved i wont be bothered by 2 but if
there's something to do on the meantime... :)
10X,
Mick Doherty - 21 Oct 2004 20:36 GMT
add a reference to system.Design.dll
\\\\\\
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing.Design
Public Class MyTabControl
Inherits UserControl
'Windows Form Designer generated code
<Editor(GetType(TabPageCollectionEditor), GetType(UITypeEditor))> _
Public ReadOnly Property TabPages() As ControlCollection
Get
Return Controls
End Get
End Property
Friend Class TabPageCollectionEditor
Inherits CollectionEditor
Public Sub New(ByVal type As System.Type)
MyBase.new(type)
End Sub
Protected Overrides Function CreateCollectionItemType() As System.Type
Return GetType(MyTabPage)
End Function
End Class
End Class
Public Class MyTabPage
Inherits ScrollableControl
'...
End class
//////

Signature
Mick Doherty
http://dotnetrix.co.uk/nothing.html
> hi,
> 10X for the "CanParent" tip, i solved it through overriding the
[quoted text clipped - 28 lines]
>
> 10X,
dd_smith - 28 Dec 2004 05:37 GMT
I have a similar user control designer issue. You mentioned ' I was able to
replicate the .NET TabControl with buttons to click on and panels as detail
where user can drag controls into.' Is there any way you can post that? I
am trying to develop a custom tab control that unfortunately extending the
existing tab control won't do.
> > Joey - it sounds rather complicated. and im not sure it's possible
> (although
[quoted text clipped - 17 lines]
> You should attach a custom designer to your custom panel control inheriting
> from ParentControlDesigner and then override the CanParent method...