Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Forcing a C# form Datagrid to repaint

Forcing a C# form Datagrid to repaint

Scheduled Pinned Locked Moved C#
csharpcssdesignhelp
3 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vernware
    wrote on last edited by
    #1

    I am working in C#.net and have a Datagrid control. The grid seems to work ok except for a new problem I have noticed. When I resize the main form (and consequently the Datagrid) and scroll around the Datagrid using the forms scroll bars and then maximize the form and the Datagrid I notice that the Datagrid does not seem to repaint properly. The entire grid design is messed up. I suspect this may be a repaint problem. Somehow and somewhere I need to force the grid to repaint. I would appreciate any tips as to how and where I should do this. Thanks, Vern Vern

    A 1 Reply Last reply
    0
    • V Vernware

      I am working in C#.net and have a Datagrid control. The grid seems to work ok except for a new problem I have noticed. When I resize the main form (and consequently the Datagrid) and scroll around the Datagrid using the forms scroll bars and then maximize the form and the Datagrid I notice that the Datagrid does not seem to repaint properly. The entire grid design is messed up. I suspect this may be a repaint problem. Somehow and somewhere I need to force the grid to repaint. I would appreciate any tips as to how and where I should do this. Thanks, Vern Vern

      A Offline
      A Offline
      axos88
      wrote on last edited by
      #2

      I can't really understand what your problem is, maybe you should be a little more clear on when the datagrid does not repaint itself correctly. As for HOW you can repaint it, datagrid.Invalidate(); should do the trick Regards, Vandra Akos

      V 1 Reply Last reply
      0
      • A axos88

        I can't really understand what your problem is, maybe you should be a little more clear on when the datagrid does not repaint itself correctly. As for HOW you can repaint it, datagrid.Invalidate(); should do the trick Regards, Vandra Akos

        V Offline
        V Offline
        Vernware
        wrote on last edited by
        #3

        Vandra: Thanks for the tip about the datagrid.Validate(). I put this in the Scroll event of the datagrid and this solved the problem I was having. Let me try to explain the problem I was having again: First I resize the datagrid so that the scroll bars show up. Then I scroll around the datagrid. Finally I resize the Datagrid so that it fills the screen. Now when I scroll again, the grid is messed up. Some columns appear twice, some don’t appear at all, its just really messed up. Anyway, when I put the Datagrid.Invalidate() in the Scroll event, all is well. Thanks again for your help. Vern Vern

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups