ListView等效于listBox.TopIndex [英] ListView equivalent of listBox.TopIndex

查看:257
本文介绍了ListView等效于listBox.TopIndex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过编码强制列表框滚动到最近添加的项目:
listBox.TopIndex = listBox.Items.Count - 1;
我可以通过编码定位到特定的listBox项:
listBox1.TopIndex = gotoIndex;

如何在ListView详细信息视图中执行相同的功能?

I can force a list box to scroll to the most recently added item by coding:
listBox.TopIndex = listBox.Items.Count - 1;
and I can position to a specific listBox item by coding:
listBox1.TopIndex = gotoIndex;

How can I perform the same functions in a ListView details view?

推荐答案

请尝试ListView.EnsureVisible(int index).请参阅此处: http://msdn.microsoft.com/zh-CN /library/system.windows.forms.listview.ensurevisible.aspx [
Please try ListView.EnsureVisible(int index). See here: http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.ensurevisible.aspx[^]


ListView具有您可以使用的TopItem属性.
ListView has the TopItem property that you could use.


ListView.EnsureVisible(int index)起作用.谢谢!
ListView.EnsureVisible(int index) works. Thanks!


这篇关于ListView等效于listBox.TopIndex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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