datagridview degradation and form focus

Posted on 2009-04-22
Last Modified: 2012-05-06
I have a form with a large dgv on it that always degrades when something else on the screen is clicked.  Does anyone know why?  I have a function that refreshes the grid when another panel is shown and then returned to the panel with the grid which works fine, albeit a little screen flicker.  Is there a way to know when the form is now the one with focus on the screen so that the refresh function can be called?
Question by:ddepuemd

    Author Comment

    Hey experts!  Doesn't anyone know how to fix this?

    The first picture is a normal display, without this line in the cell painting method:

    e.AdvancedBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.InsetDouble

    the second picture is with the line in the method.  How do I fix this?  The code is necessary in order to paint the red lines, which is essential.  HELP!

    Author Comment

    the second picture is only what happens to the display when another window is dragged over the grid.

    Accepted Solution

    I found the answer.  Rather than draw the lines in the cellpainting event, I draw them in the dgv.paint event.  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    737 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

    17 Experts available now in Live!

    Get 1:1 Help Now