如何增加ToolTip显示时间?

时间:2012-08-18 05:06:11

标签: c# asp.net visual-studio-2008 time tooltip

我有一个GridView,在它的RowDataBound事件中,我正在分配ToolTip如下:

protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
    try
    {
        if (gv.HeaderRow != null && e.Row.RowType == DataControlRowType.DataRow)
        {  
            e.Row.ToolTip = "Remarks: " + ((Label)e.Row.FindControl("lblRemarks")).Text;
        }
    }
    catch (Exception ex)
    {
        BussinessLayer.RIBOException.Instance.HandleMe(this, ex);
    }
}

在这里,我想延长ToolTip的显示时间。 怎么做?

4 个答案:

答案 0 :(得分:5)

您需要使用ToolTipService,特别是ShowDuration attached property

设置工具提示后,您应该可以执行以下操作:

ToolTipService.ShowDuration(e.Row, 10000)

答案 1 :(得分:3)

设置ToolTipService.ShowDuration属性。

答案 2 :(得分:1)

<Button x:Name="btnHelp" ToolTip="For new paragraph : press Enter &#x0a;For new line : press Shift+Enter">
 <ToolTipService.ShowDuration>15000</ToolTipService.ShowDuration>
</Button>

答案 3 :(得分:0)

这有效,提供间距和其他格式选项。以上接受的选项不起作用

<div runat="server" class="tooltip" id="divHowTo" style="display: inline-block; width:75px" data-tip="If you have problems: &#013;&#010;
        1.) Enter a users id &#013;&#010;
        2.) Choose a corresponding domain for the pin  &#013;&#010;
        3.) Verify resolved name is correct  &#013;&#010;
        4.) (If adding) Browse for Picture (jpg/png format) (square resolution) (240px X 240px or larger)  &#013;&#010;
        5.) Choose a button to add or delete or view or save or clear " >
    <asp:Image ID="imgHowTo" runat="server" ImageUrl="Images/howTo1s.jpg"  Height="73px" Width="73px"/>

    </div>

的类(在&lt; style&gt;和&lt; / style&gt;之间)

    .tooltip {
                display:inline-block;
                width:64px;
                height:64px;
                position:relative;
                margin:25px;
                background-repeat: no-repeat;
                background-position:50% 50%;
                background-size:100%;
                text-align:center;
                line-break:auto;
                white-space:pre-line;
            }
    .tooltip:hover:after {
                display:inline-block;
                position:absolute;
                top:-25px;
                left:50%;
                height:400px;
                content: attr(data-tip);
                font:bold 10px/14px Arial, sans-serif;
                background:#f0f0f0;
                color:#333;
                white-space:pre-line;
                border:1px solid #665;
                padding:2px 4px;
                width:150px;
                margin:0 0 0 -75px;
                border-radius:3px;
                line-break:auto;
            }
    .tooltip:hover:before {
                border-top: 10px solid #665;
                border-top: 10px solid #665;
                margin-top: 5px;
                content: "";
                position: absolute;
                border-left: 5px solid transparent;
                border-right: 10px solid transparent;
                top:-15px;
                left: 50%;
                margin-left: -10px;
                line-break:auto;
                white-space:pre-line;
            }