• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

VB.net Excel Add-in TaskPane Paint causing issues

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
Murray Brown
Asked:
Murray Brown
  • 2
1 Solution
 
CodeCruiserCommented:
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
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Excellent suggestion. I had been wondering abou that all day. Thanks
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now