的WinForms:如何以编程方式在C#列表视图显示的最后一个项目时,有垂直滚动条? [英] Winforms: How can I programmatically display the last item in a C# listview when there are vertical scrollbars?

查看:199
本文介绍了的WinForms:如何以编程方式在C#列表视图显示的最后一个项目时,有垂直滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何编程在C#列表视图显示的最后一个项目时,有垂直滚动条?我研究与列表视图关联的每个方法并不能发现任何东西。

How can I programmatically display the last item in a C# listview when there are vertical scrollbars? I've studied every method associated with listviews and can't find anything.

推荐答案

这不是真正容易/可滚动列表视图。你需要告诉该项目,以确保它是可见的。

It's not actually easy/possible to scroll the list view. You need to tell the item to make sure it's visible.

var items = listView.Items;
var last = items[items.Count-1];
last.EnsureVisible();

这篇关于的WinForms:如何以编程方式在C#列表视图显示的最后一个项目时,有垂直滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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