Apparently the designer cannot create the window for the Form. I tried your code and it worked fine for me as is so I don't know what the problem is. However, this is not really how you're supposed to derive from Form. Here is the proper way:-
vbnet Code:
Imports System.ComponentModel
'Prevents the Forms designer from loading
'as this Form is a base class from which your
'application's Forms can inherit, it's not meant to be designed upon
<ToolboxItem(False)> _
Public Class BlackComponent
Inherits Component
End Class
Public Class EditorFormBase
Inherits Form
Private _color As Color = Color.FromArgb(32, 40, 56)
Private _font As Font = New Font("segoe ui", 8.5)
Private _formBorderStyle As Windows.Forms.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Private _foreColor As Color = Color.FromArgb(128, 144, 160)
<Browsable(True), DefaultValue(GetType(Color), "32, 40, 56"), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
Overrides Property BackColor As Color
Get
Return _color
End Get
Set(value As Color)
MyBase.BackColor = value
End Set
End Property
<Browsable(True), DefaultValue(GetType(Color), "128, 144, 160"), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
Overrides Property ForeColor As Color
Get
Return MyBase.ForeColor
End Get
Set(value As Color)
If Not MyBase.ForeColor = value Then
MyBase.ForeColor = value
Invalidate()
End If
End Set
End Property
Sub New()
' Add any initialization after the InitializeComponent() call.
SetStyle(Windows.Forms.ControlStyles.OptimizedDoubleBuffer Or Windows.Forms.ControlStyles.SupportsTransparentBackColor Or Windows.Forms.ControlStyles.UserPaint, True)
DoubleBuffered = True
BackColor = _color
ForeColor = _foreColor
Font = _font
FormBorderStyle = _formBorderStyle
End Sub
End Class
I put the above in its own code file. When I need an editor form I simply inherit from EditorFormBase by changing the designer file for whatever Form I'm making.