I have been using this control for over a year now and suddenly it randomly causes exceptions. And by random, I mean I can rebuild the solution and the form with load correctly. Sometimes I have to rebuild two or three times, but eventually it will work properly. The stack trace is vague at best. This might be easier if the exception was consistent.
Here is the entire code of the control:
VB.NET Code:
Imports System.ComponentModel Imports System.Drawing Public Class EditorForm 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() ' This call is required by the designer. InitializeComponent() ' 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
VB.NET Code:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class EditorForm Inherits System.Windows.Forms.Form 'UserControl overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.SuspendLayout() ' 'EditorForm ' Me.BackColor = System.Drawing.Color.FromArgb(CType(CType(32, Byte), Integer), CType(CType(40, Byte), Integer), CType(CType(56, Byte), Integer)) Me.ClientSize = New System.Drawing.Size(737, 590) Me.DoubleBuffered = True Me.Font = New System.Drawing.Font("Segoe UI", 8.5!) Me.ForeColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(144, Byte), Integer), CType(CType(160, Byte), Integer)) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.Name = "EditorForm" Me.ResumeLayout(False) End Sub End Class
Attached is a screencap I grabbed of the error.




Reply With Quote