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? :)


Thanks again to everyone, Stano.


>Make sure the panel has the focus before you drop the control onto it.
>If you want to paste an existing control in a panel, cut it first and
>then select the panel and paste the control.
>
>Charlotte Foust
>
>
>
>
>Hello everybody.
>
>
>I created my own control (inherited form
>System.Windows.Forms.UserControl) named MiniInfo. It is acts something
>like a very small form (though it's not a form) ... I want to put
>another controls inside it even in design mode. So the designer
>attribute is:
>
><DesignerAttribute("System.Windows.Forms.Design.ParentControlDesigner")>
>
>Everything is OK a it works as expected. When I place for example button
>on it in design mode it is there ... on that MiniInfo control - MiniInfo
>is parent of this button.
>
>But now I hane a Panel on MiniInfo (it is part of this control) and in
>design mode, when I drop a control on MiniInfo, I want it to be added
>into this panel - the panel will be the parent of dropped controls. I am
>not able to solve this. WHen I just drop a control on MiniInfo, it
>becomes a parent of this control automatically ant thus the button is
>behind that panel.
>
>I want to make the panel parent of dropped controls.
>
>Does anybody know how to achieve this?
>
>
>Thanks, Stano.
>

===================================
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