ToolTip Width

2 posts, 0 answers
  1. solution
    solution avatar
    1 posts
    Member since:
    May 2016

    Posted 21 May 2016 Link to this post

    I use the following code to display a tooltip. My problem is that I cannot set the tooltip maximum width. How can I do this?

    GridDataCellElement cell = sender as GridDataCellElement;
    if (cell != null && cell.ColumnInfo.Name == "MessageText")
    {
        e.ToolTip.OwnerDraw = true;
        e.ToolTip.Draw += ToolTip_Draw;
        e.ToolTip.AutoPopDelay = int.MaxValue; // 24.86 days
                     
        e.ToolTipText = cell.Value.ToString();
    }
     
    void ToolTip_Draw(object sender, DrawToolTipEventArgs e)
    {
        e.Graphics.FillRectangle(SystemBrushes.Info, e.Bounds);
        e.DrawBorder();
        e.DrawText(TextFormatFlags.RightToLeft | TextFormatFlags.Right);
    }

    GridDataCellElement cell = sender as GridDataCellElement;
    if (cell != null && cell.ColumnInfo.Name == "MessageText")
    {
        e.ToolTip.OwnerDraw = true;
        e.ToolTip.Draw += ToolTip_Draw;
        e.ToolTip.AutoPopDelay = int.MaxValue; // 24.86 days
                    
        e.ToolTipText = cell.Value.ToString();
    }
    void ToolTip_Draw(object sender, DrawToolTipEventArgs e)
    {
        e.Graphics.FillRectangle(SystemBrushes.Info, e.Bounds);
        e.DrawBorder();
        e.DrawText(TextFormatFlags.RightToLeft | TextFormatFlags.Right);
    }
  2. Dess
    Admin
    Dess avatar
    1736 posts

    Posted 23 May 2016 Link to this post

    Hello,

    Thank you for writing. 

    Note that RadGridView uses the MS Tooltip. In order to change its size, you can refer to the following link where in the ToolTip.Popup event, the ToolTipSize is modified according to exact requirements: http://www.c-sharpcorner.com/uploadfile/hrojasara/how-to-change-the-size-of-tooltip/

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top