Not sure what the problem is here. I've been looking into this for about 2 hours now and haven't been able to figure out why the custom control OnPaint method won't fire.
I'm programatically adding the custom control to an existing form which looks something like this:
Dim multListCtl As New ccMultiAnswerList()
multListCtl.RowCount = 1
multListCtl.ColumnCount = 2
newPoint.Y += 20
multListCtl.Width = 300
multListCtl.Location = newPoint
Me.Controls.Add(multListCtl)
Here's what my constructor on my custom control looks like:
Public Sub New()
InitializeComponent()
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.tblAnswerLayout.ColumnCount = m_colCount + 1
Me.tblAnswerLayout.RowCount = 0
End Sub
And the OnPaint method:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
DrawAnswerList()
End Sub
Any ideas as to why this might be happening?