Hello,
The default tool tip of a gridview cell isn't displayed long enough.
I tried a few solutions and almost all events but it's still flickering.
I solved it with the following code but then it doesn't appear in special situations (appears only for a few milliseconds). May be if i'm too fast with the mouse?!
I also wanted to show the tooltip only, if the cell text is truncated like in the default behaviour but is there an easy solution without measuring?
_toolTip = new ToolTip();
//_toolTip.AutomaticDelay = 100;
_toolTip.AutoPopDelay = 30000;
//_toolTip.ReshowDelay = 100;
gvRightButton.ShowCellToolTips = false;
private static DataGridViewCell ccell;
private void gvTest_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
var cell = gvTest.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (e.ColumnIndex >= 1 & e.RowIndex >= 0 && cell != ccell)
{
ccell = cell;
_toolTip.Show(gvTest.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), gvTest, 30000);
}
}
private void gvTest_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
if (!string.IsNullOrEmpty(_toolTip.GetToolTip(gvTest)))
{
_toolTip.Hide(gvTest);
}
}
Regards
