如何实现 C#winform ListView 鼠标移入行时,行变色高亮
1个回答
展开全部
ItemMouseHover事件
e.Item获取项 然后在做处理
或者用DrawItem事件吧
private void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
{
if(e.State == ListViewItemStates.Hot)
{
Pen blackPen = new Pen(Color.FromArgb(255, 0, 0, 0), 5);
e.Graphics.DrawRectangle(blackPen, e.Item.Bounds);
}
}
e.Item获取项 然后在做处理
或者用DrawItem事件吧
private void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
{
if(e.State == ListViewItemStates.Hot)
{
Pen blackPen = new Pen(Color.FromArgb(255, 0, 0, 0), 5);
e.Graphics.DrawRectangle(blackPen, e.Item.Bounds);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询