I overtook WndProc from ComboBox and I draw my own combo box, a snapshot of the code below:
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
Select Case m.Msg
Case &HF
Dim g As Graphics = Me.CreateGraphics
If ComboBoxRenderer.IsSupported Then
Dim pTextBoxRect As New Rectangle(Me.ClientRectangle.X, Me.ClientRectangle.Y, Me.ClientRectangle.Width, Me.ClientRectangle.Height)
ComboBoxRenderer.DrawTextBox(g, pTextBoxRect, _tbState)
' .... and so on
End Select
End Sub
Although the old control is still painted, as my drawn combo box just overlaps the old drawing. Is there a way to stop it when creating a default combo box?
Thanks Rob
source
share