public void EnsureVisible (int index)
{
if (index < top_item) {
vscroll.Value = index;
} else {
int max = vscroll.Maximum - page_size + 1;
int rows = Height / item_height;
if (index > top_item + rows - 1) {
index = index - rows + 1;
vscroll.Value = index > max ? max : index;
}
}
}