How to display all rows in Grdiview without displaying scrollbar

◇◆丶佛笑我妖孽 提交于 2020-01-05 23:00:25

问题


I have gridview with few hundreds rows, how can I force the gridview to extend it's hight and display all rows without scroolbar?

C# 3.0 / .net 3.5 /


回答1:


The DataGridView has several things which could help you to calculate the height:

  • DisplayedColumnCount
  • DisplayedRowCount - in relation to Rows.Count
  • Rows -> GetRowsHeight()
  • ColumnHeadersHeight
  • RowTemplate - Height

But i would be really interested on which display resolution you display a few hundred rows without scrolling.

Last but not least (nor tested): Take a look into the properties AutoSize and AutoSizeMode




回答2:


You want display all the handreds rows without scrrolbar. you must change the height of the GridView when you load data.

DataGridView.Height= xxx
Load data


来源:https://stackoverflow.com/questions/3263562/how-to-display-all-rows-in-grdiview-without-displaying-scrollbar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!