Solved

VB.net DataGridView image distorting

Posted on 2013-01-20
2
424 Views
Last Modified: 2013-01-24
Hi

I have a DataGridView on a TabControl that distorts wheb I alternate tabs as
shown in the image. I use the code below to get a gradient effect behind the tab page.
Not sure why this happens.

 12

    Private Sub TabPage2_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles TabPage2.Paint
        Try
            Dim graphics As Graphics = e.Graphics()

            Dim rectBrush As New System.Drawing.Rectangle(0, 0, 310, 1200)
            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
0
Comment
Question by:murbro
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 38801232
It sounds like you need to use the Invalidate method, to force a repaint.
0
 

Author Closing Comment

by:murbro
ID: 38815932
Thanks Bob. That worked well
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A short film showing how OnPage and Connectwise integration works.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

929 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

9 Experts available now in Live!

Get 1:1 Help Now