2 Attachment(s)
[2008] Drawing Panel background on Vista
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.
Re: [2008] Drawing Panel background on Vista
I'm going to send this to the top one time. I can't figure it out.
I'm considering completely taking this control out of my project since it doesn't seem to work in this instance on Vista - unless you can help. ;)
Re: [2008] Drawing Panel background on Vista
You might want to PM RobDog888 to take a look at this thread. He may already have seen it and passes but I know he was working on a custom control with a gradient background some time ago. It may have been before he was using Vista though, so he may not know the solution.
Re: [2008] Drawing Panel background on Vista
have you tried using size changed event instead?