void FileStatusListView_MouseMove(object sender, MouseEventArgs e) { ListView listView = sender as ListView; //DRAG // If the mouse moves outside the rectangle, start the drag. if (dragBoxFromMouseDown != Rectangle.Empty && !dragBoxFromMouseDown.Contains(e.X, e.Y)) { if (SelectedItems.Any()) { StringCollection fileList = new StringCollection(); foreach (GitItemStatus item in SelectedItems) { string fileName = Path.Combine(Module.WorkingDir, item.Name); fileList.Add(fileName.Replace('/', '\\')); } DataObject obj = new DataObject(); obj.SetFileDropList(fileList); // Proceed with the drag and drop, passing in the list item. DoDragDrop(obj, DragDropEffects.Copy); dragBoxFromMouseDown = Rectangle.Empty; } } //TOOLTIP if (listView != null) { var point = new Point(e.X, e.Y); var hover = listView.HitTest(point); if (hover.Item != null) { var gitItemStatus = (GitItemStatus)hover.Item.Tag; string text; if (gitItemStatus.IsRenamed || gitItemStatus.IsCopied) { text = string.Concat(gitItemStatus.Name, " (", gitItemStatus.OldName, ")"); } else { text = gitItemStatus.Name; } float fTextWidth = listView.CreateGraphics().MeasureString(text, listView.Font).Width + 17; //Use width-itemheight because the icon drawn in front of the text is the itemheight if (fTextWidth > (FileStatusListView.Width - FileStatusListView.GetItemRect(hover.Item.Index).Height)) { if (!hover.Item.ToolTipText.Equals(gitItemStatus.ToString())) { hover.Item.ToolTipText = gitItemStatus.ToString(); } } else { hover.Item.ToolTipText = ""; } } } }