VB.net Excel Add-in TaskPane Paint causing issues

Posted on 2013-02-04
Medium Priority
Last Modified: 2013-02-05

I have a TaskPane in my Excel VB.net Add-in that uses the Paint event
behind a TabPage Control to achieve a gradient finish. I am having problems with the TreeView freezing at times and I also have to use my scroll buttons instead of the mouse.
Does painting the Taskbar usually cause these problems. I think that the TabPage might be the main cuplprit
My code is below.

    Private Sub TabPage3_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles TabPage3.Paint

            Dim graphics As Graphics = e.Graphics()

            Dim rectBrush As New System.Drawing.Rectangle(0, 0, 450, 600)
            Dim brush As LinearGradientBrush
            brush = New LinearGradientBrush(rectBrush, Color.FromArgb(46, 100, 160), _
                            Color.White, LinearGradientMode.Horizontal)
            graphics.FillRectangle(brush, rectBrush)
        Catch ex As Exception

        End Try
    End Sub

Question by:Murray Brown
  • 2
LVL 83

Accepted Solution

CodeCruiser earned 2000 total points
ID: 38854515
Can you not use BackgroundImage property of tabpage to show the gradient instead of painting it?


Author Comment

by:Murray Brown
ID: 38855942
Excellent suggestion. I had been wondering abou that all day. Thanks

Author Closing Comment

by:Murray Brown
ID: 38855944

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
What to do if a split doesn't fit? Or a bunch of invoice lines must be rounded while the sum must match a total? It takes a little, but - when done - it is extremely easy to implement.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question