Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
1.00/5 (1 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:

C#
this.dataGridView13.AllowUserToAddRows = false;
                    this.dataGridView13.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
Posted
Updated 13-Nov-19 20: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.

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;
 
Share this answer
 
v2
Comments
Member 14192879 13-Nov-19 22:48pm    
i tried all these methods given in the link.
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900