I think the code will not works on designmode, any how this the same code with a little modification but in VB. Net
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Security.Permissions
Imports System.Drawing.Drawing2D
Public Class RiverNilDateTimePicker
Inherits DateTimePicker
Private m_BlendColorDark As Color = Color.Blue
Private m_BlendColorLight As Color = Color.Cyan
Private Const WM_ERASEBKGND As Integer = &H14
<securitypermission(securityaction.linkdemand,> _
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If (m.Msg = WM_ERASEBKGND) Then
Using g As Graphics = Graphics.FromHdc(m.WParam)
Dim myFactors As Single() = New Single() {0.0F, 0.2F, 0.5F, 0.7F, 1.0F, 0.7F, 0.5F, 0.2F, 0.0F}
Dim myPositions As Single() = New Single() {0.0F, 0.1F, 0.3F, 0.4F, 0.5F, 0.6F, 0.7F, 0.8F, 1.0F}
Dim myBlend As New Drawing2D.Blend
Dim rect As New Rectangle(New Point(1, 1), New Size(MyBase.ClientRectangle.Width - 19, MyBase.ClientRectangle.Height - 4))
Using lgb As New Drawing2D.LinearGradientBrush(rect, Color.FromArgb(64, Me.m_BlendColorDark), Color.FromArgb(36, m_BlendColorLight), 90, False)
lgb.Blend = myBlend
g.FillRectangle(lgb, rect)
End Using
End Using
m.Result = IntPtr.op_Explicit(1)
Return
End If
MyBase.WndProc(m)
End Sub
End Class