This is a migrated thread and some comments may be shown as answers.

ToolTip Width

1 Answer 379 Views
GridView
This is a migrated thread and some comments may be shown as answers.
solution
Top achievements
Rank 1
solution asked on 21 May 2016, 08:21 AM

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);
}

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 May 2016, 01:27 PM
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 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.
Tags
GridView
Asked by
solution
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or