我已经覆盖了 ComboBox 的 WndProc 并且正在绘制自己的组合框,代码片段如下:
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
虽然旧控件仍在绘制,因为我绘制的组合框只是与旧图重叠。有没有办法阻止它绘制默认组合框?
谢谢,罗伯