0

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?

Sinatr
  • 20,892
  • 15
  • 90
  • 319

1 Answers1

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

This will solve your problem.

Cem Mutlu
  • 1,969
  • 1
  • 24
  • 24
  • `var visible = listView1.Items[listView1.SelectedIndices[0]].Bounds.IntersectsWith(listView1.ClientRectangle)` and it perfectly works, thanks! – Sinatr Aug 20 '13 at 16:38