At this point, I think it's safe to conclude that the Krypton Toolkit Panel
do not have the control style UserPaint
.
"If true, the control paints itself rather than the operating system doing so. If false, the Paint event is not raised. This style only applies to classes derived from Control." - MSDN
If possible, you can try one of the following options.
Start by creating a custom control derived from Krypton Toolkit Panel
.
Option 1
Append the flag in the constructor. (This will probably break the custom drawings in base class)
Public Sub New()
MyBase.SetStyle(ControlStyles.UserPaint, True)
End Sub
Option 2
Override WndProc
.
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Try
If ((m.Msg = WM_PAINT) OrElse (m.Msg = WM_ERASEBKGND)) Then
Using g As Graphics = Me.CreateGraphics()
Me.OnPaint(New PaintEventArgs(g, Me.ClientRectangle))
End Using
End If
Catch ex As Exception
Finally
MyBase.WndProc(m)
End Try
End Sub
Const WM_PAINT As Integer = 15
Const WM_ERASEBKGND As Integer = 20