Check if selected item is visible [virtual ListView in details view]

牧云@^-^@ 提交于 2019-12-12 05:13:50

问题


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?


回答1:


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

This will solve your problem.



来源:https://stackoverflow.com/questions/18339133/check-if-selected-item-is-visible-virtual-listview-in-details-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!