What about handling the ControlAdded event and modifying the Parent and/or
Container properties of the Control being added?

-- Peter
http://www.peterRitchie.com/

On Thu, 21 Apr 2005 03:13:30 -0400, Stanislav Petko <[EMAIL PROTECTED]> wrote:

>Well. Thanks for answers, but it seems, I did not express clearly.
>
>
>Note: You can create your own control in MS Visual Studio .NET (2003) by:
>"File -> Add New Item... -> User Control" in your project.
>
>
>My own control named MiniInfo (based on System.Windows.Forms.UserControl) is
>control I can use in another projects. It contains label (for a caption),
>some buttons (together with handlers to control MiniInfo) etc. When built, I
>have a small dll.
>
>In another projects, I can add it into my ToolBox and use it as all the
>other controls (buttons, labels, text boxes, panels...). I can drop it on a
>form, set size and so on. It still has that buttons and a label I created it
>with, but I cannot select them anymore independently (and I dont need to),
>because now it acts as a ONE control.
>
>Because it is declared as
>
><DesignerAttribute("System.Windows.Forms.Design.ParentControlDesigner")>
>
>it is similar to for example GroupBox or Panel, so once it is on a form, I
>can drop another controls on MiniInfo and they belong to it (move with it
>etc.). MiniInfo is a parent of controls dropped on it.
>
>
>But now, I would like to do this. When designing the control itself, I put a
>Panel on in and when using in in another projects, when I drop a button or
>anything on MiniInfo, I want it to be added into THIS panel's controls list
>(Panel will be parent of dropped controls). I can't select panel, because it
>is not independent. It is a part of MiniInfo. When I drop something on
>MiniInfo, it is behind that panel and the parent of dropped item is MiniInfo
>as a whole.
>
>
>I cannot simply in a code do somethig like panel.SendToBack(). I really need
>(or it would be great for further progress) to really somehow make it to be
>tha panel a parent of dropped controls.
>
>
>Any ideas how to do this? :)

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to