C# Don';在从窗口窗体中的DataGridViewCell中删除鼠标之前,不要隐藏工具提示

C# Don';在从窗口窗体中的DataGridViewCell中删除鼠标之前,不要隐藏工具提示,c#,windows,winforms,tooltip,C#,Windows,Winforms,Tooltip,我必须显示DataGridViewCell的工具提示。 下面是代码 private void dgrSearch_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == 1 && e.RowIndex >= 0 && (e.ColumnIndex == this.dgrSearch.Columns["ID"]

我必须显示DataGridViewCell的工具提示。 下面是代码

private void dgrSearch_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
    {
        if (e.ColumnIndex == 1 && e.RowIndex >= 0 && (e.ColumnIndex == this.dgrSearch.Columns["ID"].Index) && e.Value != null)
        {
            DataGridViewCell cell = this.dgrSearch.Rows[e.RowIndex].Cells[e.ColumnIndex];                
            string tooltip = this.dgrSearch.Rows[e.RowIndex].Cells["Description"].Value.ToString();
            cell.ToolTipText = tooltip;                
        }

    }

windows中工具提示的默认行为是在一段时间后自动隐藏。但我的要求是,如果用户将鼠标悬停在单元格上,则显示工具提示,直到鼠标悬停在该单元格上。

以下是您尝试执行的操作

适当的暂停 适当的自动显示和删除提示对于用户保持对其UI环境的控制至关重要。提示有三个超时值:

首字母。指针必须保持静止以使尖端移动的时间 出现。默认时间为0.5秒

雷肖。指针作为指针必须保持静止的时间 从一个目标移动到另一个目标。默认时间为0.1秒

移除。自动移除尖端的时间。这个 默认时间为5秒


初始值和重新显示值太短会导致烦人的、破坏性的体验,因为它们经常会在无意中显示出来,而过长会导致提示感觉没有反应或没有被发现。默认删除时间适用于工具提示中使用的短提示文本。信息提示的文本较长,因此需要较长的显示时间。

您可以禁用默认工具提示(因为无法配置它),然后自己提供一个。标准工具提示,具有非常高的
autocopdelay
值,
InitialDelay
ReshowDelay
设置为
0
ShowAlways=true
(作为默认工具提示)。在CellEnter中,可以将工具提示设置为,例如,
toolTip1.Show(“一些文本”,dataGridView1,dataGridView1.PointToClient(Cursor.Position))
并将其隐藏在手机上。这可能会有帮助:。阅读答案下面的注释。您还可以找到DataGridView使用的工具提示组件并对其进行操作。这可能有助于: