You need to implement a Designer for your usercontrol and create the panel
in it's OnSetComponentDefaults() method.
Here's a basic example in VB.
note: you need to add a reference to System.Design.dll.
\\\
Imports System.ComponentModel
Imports System.ComponentModel.Design
<Designer(GetType(MyDesigner))> _
Public Class MyUserControl
Inherits System.Windows.Forms.UserControl
'Your code here
End Class
Friend Class MyDesigner
Inherits System.Windows.Forms.Design.ControlDesigner
Public ReadOnly Property DesignerHost() As IDesignerHost
Get
Return DirectCast(GetService(GetType(IDesignerHost)), _
IDesignerHost)
End Get
End Property
Public ReadOnly Property HostControl() As Control
Get
Return Me.Control
End Get
End Property
Public Overrides Sub OnSetComponentDefaults()
Dim p As Panel = DirectCast(Me.DesignerHost.CreateComponent _
(GetType(Panel)), Panel)
p.Location = New Point(10, 40)
p.Size = New Size(HostControl.Width - 20, HostControl.Height - 50)
p.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or _
AnchorStyles.Right Or AnchorStyles.Bottom
HostControl.Controls.Add(p)
End Sub
End Class
///
--
Mick Doherty
http://dotnetrix.co.uk/nothing.html [quoted text, click to view] "RoadRunner News" <jeffreynospam@jeffreygilliland.com> wrote in message
news:edBdYIwuFHA.3236@TK2MSFTNGP14.phx.gbl...
> "I have a custom control that has a panel inside of it. I need the panel
> exposed as a control in design time when I place an instance of the custom
> control onto a form. In other words, I need to be able to put objects into
> the panel when the custom control has been placed onto a form. By default,
> the panel is not in design time, and thus I can not place objects inside
> of it."
>