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

Tooltips font and delay

1 Answer 341 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Philippe
Top achievements
Rank 2
Philippe asked on 05 Feb 2013, 05:07 PM
Hello

I have a RadGridView, and when a user hovers the mouse over a cell, I would like to give him a "how did this data got here" kind of tooltip. Using RadGridView1_ToolTipTextNeeded works well, and allows me to query the database for the detailled informations of a cell, but I would like to display it in a column-aligned tooltip to make it easy to read. I created a complex method that "pad" the tooltip "columns" according to the number of characters, but I got caught by the rookie mistake that the default font is not fixed size (like Arial).

Is there a way to change the displayed font?

Also, can the tooltip display timer be increased? I would like the user to have time to read it before it closes.

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Anton
Telerik team
answered on 08 Feb 2013, 04:24 PM
Hello Philippe,

Thank you for writing.

We have two types of tooltips that we show for our controls.The first one is the standard Windows Forms tooltip that does not support a great level customizations. However, you can read in the following forum thread how to change the font of the standard tooltips: http://social.msdn.microsoft.com/forums/en-US/winformsdesigner/thread/19994c9f-bdaa-4c4c-bcb4-5c60cb241134/

You can increase the duration of the ToolTip by setting AutoPopDelay property:
ToolTip toolTip = this.radGridView1.Behavior.ToolTip;
toolTip.AutoPopDelay = 2000;
e.ToolTipText = "Text";

Alternatively, you can use the second tooltip type, also known as RadScreenTip in our suite, which offers extended formatting capabilities. You simply need to subscribe to ScreenTipNeeded event of RadGridView and use the following example:
void radGridView1_ScreenTipNeeded(object sender, Telerik.WinControls.ScreenTipNeededEventArgs e)
{           
    RadOffice2007ScreenTipElement screenTip = new RadOffice2007ScreenTipElement();
    screenTip.CaptionLabel.Margin = new Padding(3);
    screenTip.CaptionLabel.Text = "Header text";
    screenTip.CaptionLabel.Alignment = ContentAlignment.TopCenter;
 
    screenTip.MainTextLabel.Text = "Text";
    e.Delay = 1;
 
    e.Item.ScreenTip = screenTip;
}

Also you can take a look at our Demo application, section GridView >> Customize >> ScreenTips to see RadScreenTip in action.

Attached is a sample project that comprises the code above.

Should you have any other questions, I will be glad to assist you.

All the best,
Anton
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
GridView
Asked by
Philippe
Top achievements
Rank 2
Answers by
Anton
Telerik team
Share this question
or