J
James Ramaley
I am trying to modify the way a NumericUpDown control draws itself. I
just need to hide the up/down arrows. I tried overriding both the
OnPaint method and the wm_paint message inside WndProc. Neither way
was successful. The overridden OnPaint method is not being called at
all. WndProc is being called but my changes have no effect, even
though I have successfully done a similar thing with ComboBox. Your
help will be greatly appreciated.
This is my test code. Here I try painting the whole control:
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
Select Case m.Msg
Case &HF
Dim g As Graphics = Me.CreateGraphics
Dim r As Rectangle = Me.ClientRectangle
g.FillRectangle(ArrowBrush, r)
Case Else
Exit Select
End Select
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
Dim r As Rectangle = Me.ClientRectangle
e.Graphics.FillRectangle(ArrowBrush, r)
End Sub
thanks
just need to hide the up/down arrows. I tried overriding both the
OnPaint method and the wm_paint message inside WndProc. Neither way
was successful. The overridden OnPaint method is not being called at
all. WndProc is being called but my changes have no effect, even
though I have successfully done a similar thing with ComboBox. Your
help will be greatly appreciated.
This is my test code. Here I try painting the whole control:
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
Select Case m.Msg
Case &HF
Dim g As Graphics = Me.CreateGraphics
Dim r As Rectangle = Me.ClientRectangle
g.FillRectangle(ArrowBrush, r)
Case Else
Exit Select
End Select
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
Dim r As Rectangle = Me.ClientRectangle
e.Graphics.FillRectangle(ArrowBrush, r)
End Sub
thanks