C# ListBox显示tooltip

来源:互联网 发布:陈妍希表情包淘宝 编辑:程序博客网 时间:2024/05/04 14:08
   private void lsbFile_MouseMove(object sender, MouseEventArgs e)
        {
            int index = lsbFile.IndexFromPoint(e.Location);
            // Check if the index is valid.
            if (index != -1 && index < lsbFile.Items.Count)
            {
                // Check if the ToolTip's text isn't already the one
                // we are now processing.
                if (toolTip1.GetToolTip(lsbFile) != lsbFile.Items[index].ToString())
                {
                    // If it isn't, then a new item needs to be
                    // displayed on the toolTip. Update it.
                    toolTip1.SetToolTip(lsbFile, lsbFile.Items[index].ToString());
                }
            }
        }
原创粉丝点击