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

l527062867 2016-05-12 11:34:55
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);
}
}
}

百度上教的防止闪烁的办法我都用了,但还是闪烁还是解决不了
...全文
256 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Struggle_hardllz 2016-05-13
  • 打赏
  • 举报
回复
http://bbs.csdn.net/topics/391873618?page=1 参考下这个,里面写好防止listview上闪烁的方法了
为轮子而生 2016-05-13
  • 打赏
  • 举报
回复
不行的话就自己做一个控件啊,这个Tooltip功能不复杂吧。做winform就是要有“凡事不好解决的事情就自己写控件来克服”的精神,只用现成的那叫门外汉。

110,586

社区成员

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

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

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