Click here to Skip to main content
14,459,483 members
Rate this:
Please Sign up or sign in to vote.
See more:
a white space “bounce” after scrolling to the bottom of datagridview. how to get rid from that white space.

What I have tried:

this.dataGridView13.AllowUserToAddRows = false;
                    this.dataGridView13.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
Posted
Updated 13-Nov-19 21:49pm
v2
Comments
Richard MacCutchan 13-Nov-19 7:29am
   
It is not clear what space you are referring to. If the grid is slightly larger than the form or panel then there may be extra space visible.
Member 14192879 13-Nov-19 22:50pm
   
I am not using any panel or form. That white space is the background of datagridview.
Rate this:
Please Sign up or sign in to vote.

Solution 1

There does not seem to be a real solution, but here are some workarounds:
c# - DatagridView: Remove unused space? - Stack Overflow[^]

And maybe this:
dataGridView1.RowTemplate.Height = this.dataGridView1.Height / TotalRows;
   
v2
Comments
Member 14192879 13-Nov-19 22:48pm
   
i tried all these methods given in the link.
Rate this:
Please Sign up or sign in to vote.

Solution 3

Member 14192879

I am not using any panel or form. That white space is the background of datagridview.


If you don't want to allow user to scroll down the grid lower than the last row, you have to implement custom painting.

Please, read this: How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control | Microsoft Docs[^]

Note: i'd not recommend to change default behaviour of datagridview painting unless you really need this. I'd change the background color if this "white space" is really annoying you.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100