C# winform 在listview上用tooltip会闪烁,求解决方案!

l527062867 2016-05-12 11:21:02
private void lvRoomInfo_MouseMove(object sender, MouseEventArgs e)
{
ListViewItem lv = this.lvRoomInfo.GetItemAt(e.X, e.Y);
int x = 0, y = 0;
if (lv != null)
{
//编辑鼠标经过时显示文本
string str = null;
foreach (ListViewItem item in lvRoomInfo.Items)
{
if (item.SubItems[0].Text == lv.Text)
{
str = string.Format("{0}\n{1}\n{2}\n{3}", item.SubItems[0].Text, item.SubItems[1].Text, item.SubItems[3].Text, item.SubItems[5].Text);
}
}
if (x != e.X || y != e.Y) //防止闪烁
{
toolTip.Show(str, lvRoomInfo, e.X, e.Y, 1000);
toolTip.Active = true;
x = e.X;
y = e.Y;
}
else
{
toolTip.Hide(lvRoomInfo);
}
}


}
...全文
93 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
为轮子而生 2016-05-13
  • 打赏
  • 举报
回复
怎么同样的问题发了两遍? 还是建议你自己实现一个DoubleBuffered为true的tooltip

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧