Results 1 to 4 of 4

Thread: [2008] Drawing Panel background on Vista

Threaded View

  1. #1

    Thread Starter
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    [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:
    1. Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
    2.     _gradientBrush = New LinearGradientBrush(Me.ClientRectangle, _
    3.                                              _gradientBackground.StartColor, _
    4.                                              _gradientBackground.EndColor, _
    5.                                              _gradientBackground.LinearGradient)
    6.     e.Graphics.FillRectangle(_gradientBrush, Me.ClientRectangle)
    7. End Sub
    8.  
    9. Protected Overrides Sub OnScroll(ByVal se As System.Windows.Forms.ScrollEventArgs)
    10.     Me.Invalidate()
    11. End Sub

    I've attached screenshots as well. Am I missing something that would cause this behavior? Thank you.
    Attached Images Attached Images   

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width