In a User Control Library, you can create a new UserControl class. This is
the class you would use for controls that are made of several constituent
controls. If you want to just inherit from Panel, change the last item in
the inherits statement from UserControl to Panel. In the InitializeComponent
routine, remove me.size = LxW.
Instead of Load, the inherited control uses:
Protected Overrides Sub OnCreateControl()
MyBase.BackColor = Color.Yellow
MyBase.BorderStyle = BorderStyle.Fixed3D
MyBase.OnCreateControl()
End Sub
Be sure that last line gets in there. The lines above that would be one way
to set defaults for existing properties. If you have an added property, you
can set the default property value in the private variable that holds the
value. If you subsequently change the value in the Properties Window, that
value would be over written.
Private _Field As String = "StartField"
Public Property Field() As String
Get
Return Me._Field
End Get
Set(ByVal Value As String)
Me._Field = Value
End Set
End Property
When you customize the toolbox, browse to the .dll created for the
UserControl Library project.
www.charlesfarriersoftware.com
"Dennis" wrote:
I am trying to set the default design proerties in a control I have derived
from the Panel Class. I thought I'd found how to do it from the MSDN but the
following line doesn't work:
Inherits System.Windows.Forms.Design.ControlDesigner
I get an error saying that the Type is not defined. I cut and pasted all
the imports and line from the MSDN.
Would appreciate any help.
--
Dennis in Houston