I have a custom Panel on which I'm drawing a gradient background and believe that I am missing something.
On Vista, I am noticing behavior that when I resize the form that contains the Panel by dragging either a side or top/bottom border, the Panel does not redraw correctly. However, when I resize by dragging the corner of the form, the Panel does redraw correctly. I don't believe I've observed this behavior on XP.
The code is pretty simple. Here is the meat of the drawing:
vb.net Code:
Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs) _gradientBrush = New LinearGradientBrush(Me.ClientRectangle, _ _gradientBackground.StartColor, _ _gradientBackground.EndColor, _ _gradientBackground.LinearGradient) e.Graphics.FillRectangle(_gradientBrush, Me.ClientRectangle) End Sub Protected Overrides Sub OnScroll(ByVal se As System.Windows.Forms.ScrollEventArgs) Me.Invalidate() End Sub
I've attached screenshots as well. Am I missing something that would cause this behavior? Thank you.




Reply With Quote