int VerticalSelectIndex = 0;
private void UcTxtAss_MouseMove(object sender, MouseEventArgs e)
{
if (Math.Abs(e.Location.Y - VerticalSelectIndex) < 2) return;//防止鼠标停留在两行之间时闪烁
int index = e.Location.Y / itemHeight+ this.dgv.FirstDisplayedScrollingRowIndex;
if (index>0&&index < dgv.Rows.Count && dgv.Rows[index].Selected == false)
{
VerticalSelectIndex = index;
dgv.Rows[index].Selected =true;
if (!this.Focused) this.Focus();
}
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
请登录后查看评论内容