You know that each item in a ListView has a ToolTipText property and that's all! There is no property like AutoPopDelay to set its display time... Always the default value, 5000 ms. I tried to associate a ToolTip to each item, but it seems to be impossible.
Is there anyway to increase the display time for ToolTipText property of a ListViewItem?
You can get the ToolTip of the ListView using LVM_GETTOOLTIPS, then send a TTM_SETDELAYTIME message to the tooltip and set its delay by passing TTDT_AUTOPOP as wparam and the delay in millisecond as lparam.
Also make sure ShowItemsToolTip property of the ListView has been set to true and the items have tooltip.
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
const int LVM_GETTOOLTIPS = 0x104E;
const int TTM_SETDELAYTIME = 0x403;
const int TTDT_AUTOPOP = 2;
private void button1_Click(object sender, EventArgs e)
{
var tooltip = SendMessage(listView1.Handle, LVM_GETTOOLTIPS, 0, 0);
SendMessage(tooltip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 10000 /*milliseconds*/);
}
To set the initial delay or the reshow delay, set the following values for wparam:
const int TTDT_AUTOMATIC = 0;
const int TTDT_AUTOPOP = 2;
const int TTDT_INITIAL = 3;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With