P
Phil Jones
I'm painting a gradient onto a control by overrideing the
"OnPaintBackground" method like so:
Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
Dim brush As New LinearGradientBrush( _
New Point(0, 0), _
New Point(ClientSize.Width, 0), _
Color.Red, _
Color.Orange)
Dim size As New Rectangle(0, 0, Me.Width, Me.Height)
e.Graphics.FillRectangle(brush, size)
End Sub
The problem is that when I resize the control, parts of the graident don't
redraw correctly (patchy squares emerge). Am I missing something here with
how you're supposed to paint things? I'm setting the fill area to the size
of the control - what should I be doing???
Many thanks!
===
Phil
(Auckland | Aotearoa)
"OnPaintBackground" method like so:
Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
Dim brush As New LinearGradientBrush( _
New Point(0, 0), _
New Point(ClientSize.Width, 0), _
Color.Red, _
Color.Orange)
Dim size As New Rectangle(0, 0, Me.Width, Me.Height)
e.Graphics.FillRectangle(brush, size)
End Sub
The problem is that when I resize the control, parts of the graident don't
redraw correctly (patchy squares emerge). Am I missing something here with
how you're supposed to paint things? I'm setting the fill area to the size
of the control - what should I be doing???
Many thanks!
===
Phil
(Auckland | Aotearoa)