如何向表单添加滚动条,以便将datagridview添加到表单中,500行没有滚动条 [英] How to add a scroll bar to a form , so that the datagridview add to the form, with 500 rows does not have scroll bar

查看:107
本文介绍了如何向表单添加滚动条,以便将datagridview添加到表单中,500行没有滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am trying to add a scroll bar to a form , so that the Datagridview add to the form,with 500 rows does not have scroll bar in c# windows. But, datagridview is not showing the bottom rows, when i tried to put the height of around 1000.

Please help me...

Thank you.





我尝试了什么:



但是,当我试图将高度设置为1000左右时,datagridview没有显示底行。



我试图在表格中添加一个面板,并给出10000px的高度,并添加高度为10000px的网格,但是它们在表格高度以下都不可见,并且滚动条都不可见。



What I have tried:

But, datagridview is not showing the bottom rows, when i tried to put the height of around 1000.

I tried to add a panel to the form, and gave the height of 10000px, and added grid with height 10000px, but both of them are not visible below the form height, and neither scroll bar is not visible.

推荐答案

我不知道为什么DGV滚动条不够用,但它不是我的应用程序。



不要打扰滚动条控件本身。除非您提供代码来处理其事件并执行您需要做的任何事情以获得效果,否则它根本不会执行任何操作。我不知道那个效果是什么,因为你没有描述你正在尝试做什么。



所以,假设你只是想要DGV在没有标题行的情况下滚动并使DGV填充整个表单,您只需在表单上删除Panel控件并将其Dock属性更改为Fill并将其AutoScroll属性更改为True。



将您的DGV添加到面板,而不是表格,您可以免费获得滚动条。
I have no idea why the DGV scrollbar is insufficient, but it's not my app.

Don't bother with the scrollbar control itself. It doesn't do anything at all unless you provide the code to handle its events and do whatever you need to do to get your effect. I have no idea what that effect is since you didn't describe what it is you're trying to do exactly.

So, on the assumption that you just want the DGV to scroll without the header rows and make the DGV fill the entire form, all you have to do is drop a Panel control on the form and change its Dock property to Fill and its AutoScroll property to True.

Add your DGV to the Panel, not the form and you get the scroll bar for free.


这篇关于如何向表单添加滚动条,以便将datagridview添加到表单中,500行没有滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆