Solved

VB.net Excel Add-in TaskPane Paint causing issues

Posted on 2013-02-04
3
232 Views
Last Modified: 2013-02-05
Hi

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
        Try

            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

1
0
Comment
Question by:murbro
  • 2
3 Comments
 
LVL 83

Accepted Solution

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

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.backgroundimage.aspx
0
 

Author Comment

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

Author Closing Comment

by:murbro
ID: 38855944
Thanks
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now