[Edit] - See edit below, I think I've figure it out!
I would like to do a similar thing to this => How to make a floating (tooltip) control in Windows.Forms? but was wondering if there was a better way now? I have tried this approach but my window seems to hang around and I'm having issues with it generally.
I know how to make tooltips for form controls (here) but the items in a listView don't seem obvious.
For my particular usage, I have a list of items in a ListView control. I would love if on ItemMouseHover I could get that little yellow tooltip box that is used to show some info or a bit of text related to the item in question.
I've created a tooltip (I think) and it just doesn't fire. I'm certainly getting the event but not the tool tip. Clearly I'm not doing this correctly. I tried variations on the below but all seem to fail miserably.
private void ShowLittleBox(object sender, ListViewItemMouseHoverEventArgs e)
{
toolTip1 = new ToolTip
{ToolTipTitle = "File Summary",AutomaticDelay = 10,BackColor = Color.Yellow};
RichTextBox rtb = new RichTextBox //I needed some window - I used a lot of them
{AutoSize = true,Visible = true,Text="Please note, only first 5 lines are shown"};
string myTextDerivedFromObject = "Eventually this will be dynamic ... ";
toolTip1.Show(myTextDerivedFromObject,rtb); //Also tried activewindow, my listview control etc.
}
Needless to say, I've been on this "swing-set" for about 4 hours give or take and need a little push ...
[EDIT]: I think I cracked it - I found that ListView a contains a separate property for allowing each item to have it's own tooltip. ListViewItem.ToolTipText Property So in the end, I just had to set that to true and add the items tooltip text when I build it.