Results 1 to 4 of 4

Thread: [2008] Drawing Panel background on Vista

  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   

  2. #2

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

    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.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: [2008] Drawing Panel background on Vista

    have you tried using size changed event instead?

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