DataGridView垂直滚动条 [英] DataGridView Vertical Scrollbar

查看:556
本文介绍了DataGridView垂直滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有dataGridView控件的winForm,它每隔几秒就会添加和删除一行。当行数超过dataGridView的长度时,滚动继续移动并调整自身大小!当添加和删除行时,如何阻止它移动和调整大小?



提前致谢,

-DA

I have a winForm with a dataGridView control that adds and removes rows every few seconds. When the number of rows exceeds the length of the dataGridView the scroll keeps moving and resizing itself! How do I stop it from moving and resizing as rows are being added and removed?

Thanks in advance,
-DA

推荐答案

你永远不应该阻止它!这是一个非常明确的行为。添加行时,滚动条的滑块会变小,以反映其相对于所有行的汇总高度的大小。是否清楚?



您可能真正需要的是能够垂直滚动到您想要显示的某一行。请参阅:

http:// msdn .microsoft.com / zh-cn / library / system.windows.forms.datagridview.firstdisplayedscrollingrowindex.aspx [ ^ ]。



参见:

http:// stackoverflow.com/questions/8437916/how-do-i-make-the-datagridview-show-the-selected-row-winforms [ ^ ],

http://social.msdn .microsoft.com /论坛/ zh-CN / winformsdatacontrols / thread / 7db968a9-38be-45fc-9dbf-e283f39d9e8c / [ ^ ]。



还有别的吗?



-SA
You should never stop it! This is a perfectly well defined behavior. The thumb of a scroll bar gets smaller size when you add a row, to reflect its size relative to the summary height of all rows. Is it clear?

What you might really need is the ability to scroll vertically to some row you want to show. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.firstdisplayedscrollingrowindex.aspx[^].

See also:
http://stackoverflow.com/questions/8437916/how-do-i-make-the-datagridview-show-the-selected-row-winforms[^],
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/7db968a9-38be-45fc-9dbf-e283f39d9e8c/[^].

Anything else?

—SA


这篇关于DataGridView垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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