检查选择的项目是可见[详细虚拟的ListView查看] [英] Check if selected item is visible [virtual ListView in details view]

查看:171
本文介绍了检查选择的项目是可见[详细虚拟的ListView查看]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么好的/短路解决SUBJ?

我能想到的:


  • GET TopItem 指数(在 VirtualMode 可它为空创建项目前?),如果所需项目的索引是更小,它是无形的,否则得到底部可见指数(指数成分股+ listView.ClientSize.Height / GetItemRect(TopItem).Height ),如果指数收集所需要的产品越多,那么它是无形的。否则可见。


  • 不知怎么检测滚动和做一些事情。


或者,也许还有一个更简单的方法?


解决方案

<$p$p><$c$c>listView1.Items[SelectedItemIndex].Bounds.IntersectsWith(listView1.ClientRectangle)

这将解决您的问题。

Is there any good/short solution to the subj?

I can think of:

  • get TopItem index (in VirtualMode can it be null before item is created?), if index of needed item is less, then it is invisible, otherwise get bottom visible index (top index + listView.ClientSize.Height / GetItemRect(TopItem).Height) and if index of needed item is more, then it is invisible. Otherwise visible.

  • detect scrolling somehow and do something.

Or maybe there is an easier way?

解决方案

listView1.Items[SelectedItemIndex].Bounds.IntersectsWith(listView1.ClientRectangle)

This will solve your problem.

这篇关于检查选择的项目是可见[详细虚拟的ListView查看]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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