I have a form with three panels. The top panel contains listboxes, the middle panel contains a grid and the bottom panel contains a grid. I need to take a screenshot of the bottom grid but sometimes there are more rows in the grid and you need to scroll to see every row. I want to make the bottom grid the size of the form before I take the screenshot and can do this by setting .Visible to false for the two top panels. My problem is that the screenshot is taken before the form has redrawn itself to show the grid as the size of the form. How can I guarantee that the form has redrawn/repainted before I execute the code to take the screenshot?
I'm using the answer of ArsenMkrt from Capture screenshot of active window? to take the screenshot.
EDIT: The grid is an Infragistics UltraGrid.