构造函数添加:
点击事件: (listview控件确保有内容,比如已查询到数据添加到了listview)
if (listView_data_base.Items.Count > 0)
{
listView_data_base.FullRowSelect = true;
listView_data_base.Items[listView_data_base.Items.Count - 1].Selected = true; //选中最后一行,列表控件属性,FullRowSelect
listView_data_base.Items[listView_data_base.Items.Count - 1].EnsureVisible();//显示内容自动滚动到最后一行
Point tmpPoint = listView_data_base.PointToClient(Cursor.Position);
ListViewItem.ListViewSubItem subitem = listView_data_base.HitTest(tmpPoint).SubItem;
textBox_search_text.Text = subitem.Text;
}