We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridControl with SuperToolTip

Is it possible to attach a SuperToolTip to each cell in GridControl?

12 Replies

AD Administrator Syncfusion Team December 29, 2006 04:04 AM UTC

Hi Ichiro,

Try setting the Style.CellTipText property to display the tooltip in a cell.

//PrepareViewStyleInfo event.
e.Style.CellTipText = e.Inner.Style.Text;

Please refer the below forum threads for more details.
For Tooltip properties : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=29799
For Tooltip Size : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=23741
For Tooltip Width : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=12940
Tooltip for largetext : http://www.syncfusion.com/support/forums/message.aspx?MessageID=52262

Best Regards,
Haneef


AD Administrator Syncfusion Team December 29, 2006 08:47 AM UTC

Hi, Haneef.
Thank you for your reply.

Yes, I can display a normal tooltip in a cell by using GridStyleInfo.CellTipText property:

gridControl1[2,3].CellTipText = "hello.";

However, my customer require the tooltip to include some pictures. I found that SuperToolTip is a tooltip with the functionality to include pictures, so I tried to bind a cell to a SuperToolTip, but failed.

Is it possible? Or is there another way to display tooltip with pictures in a cell of GridControl?

>Hi Ichiro,

Try setting the Style.CellTipText property to display the tooltip in a cell.

//PrepareViewStyleInfo event.
e.Style.CellTipText = e.Inner.Style.Text;

Please refer the below forum threads for more details.
For Tooltip properties : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=29799
For Tooltip Size : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=23741
For Tooltip Width : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=12940
Tooltip for largetext : http://www.syncfusion.com/support/forums/message.aspx?MessageID=52262

Best Regards,
Haneef


AD Administrator Syncfusion Team January 4, 2007 11:41 AM UTC

Hi Ichiro,

My apologies for the delay in response.

You need to handle the ActivateToolTip event of the grid and show the superTooltip using SuperToolTip.Show method. Here is a code snippet to show this.

//Form Load event .....
sToolTip = new SuperToolTip(this);

//Activate tooltip event.
private SuperToolTip sToolTip ;
void gridDataBoundGrid1_ActivateToolTip(object sender, GridActivateToolTipEventArgs e)
{
e.Cancel = true;
ToolTipInfo tipInfo = new ToolTipInfo();
tipInfo.BackColor = Color.Red;
tipInfo.Body.Image = SystemIcons.Information.ToBitmap();
tipInfo.Body.Text = e.Style.CellTipText +":::" + e.Style.Text ;
sToolTip.Show(tipInfo, MousePosition);
}

void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{ e.Style.CellTipText = "ToolTip Text"; } //CellTipText is used to fire the Activate ToolTip event of the grid cell.

Please refer to the attached sample for more details.
GDBGSuperTooltip.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team January 9, 2007 03:08 AM UTC

Hi, Haneef.

According to your advice, I can use SuperToolTip on each cell of GridControl.
Thank you so much!


AD Administrator Syncfusion Team February 1, 2007 02:06 AM UTC

Well, I have one more question.

Currently I can see SuperToolTip to the right of the cursor:

int toolTipX = MousePosition.X + 15;
int toolTipY = MousePosition.Y;
superToolTip.Show(_tipInfo, new System.Drawing.Point(toolTipX, toolTipY), 5000);

But I cannot see the SuperToolTip when the cursor is at the right edge of the monitor screen.
I would like the SuperToolTip to be seen even when the cursor is at the right of the screen.
For example, is it possible to have the SuperToolTip on the left side of the cursor, when the cursor is at the right most of the screen?
I would like to know how to implement this.

Thank you for your time.
I am looking forward to hearing from you soon.


AD Administrator Syncfusion Team February 1, 2007 06:17 PM UTC

Hi Ichiro,

I have modified the sample as per your requirement. Please try the attached sample and let me know if you are looking something different.

sample : ModifiedGDBGSuperTooltip.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team February 5, 2007 08:42 AM UTC

Hi Haneef,

Thank you for your reply.
I think you have understood the problem correctly.
However, I was wondering if it is possible to have the SuperToolTip just next to the cursor,
and _not_ to the far left as in the modified version you have sent to me.

SuperToolTip0.zip


AD Administrator Syncfusion Team February 5, 2007 08:46 AM UTC

I sent the message above this.
I just forgot to write my name...


AD Administrator Syncfusion Team February 5, 2007 08:18 PM UTC

Hi Ichiro,

Thanks for your update.

You can handle the ActivateToolTip event of the grid and call superTooltip.Show method to display the tooltip at required position. Here is a code snippet.

private SuperToolTip sToolTip ;
void gridDataBoundGrid1_ActivateToolTip(object sender, GridActivateToolTipEventArgs e)
{
e.Cancel = true;
ToolTipInfo tipInfo = new ToolTipInfo();
tipInfo.BackColor = Color.Red;
tipInfo.Body.Image = SystemIcons.Information.ToBitmap();
tipInfo.Body.Text = e.Style.CellTipText +":::" + e.Style.Text ;
sToolTip.MaxWidth = 150;

// sToolTip.MaxWidth(150) + 15(scroll bar width) = 165;
if (MousePosition.X + 165 < this.Location.X + this.gridDataBoundGrid1.Size.Width)
{
sToolTip.Show(tipInfo, new Point(MousePosition.X + 15, MousePosition.Y));
}
else
{
Point pt = new Point(MousePosition.X - 165, MousePosition.Y);
sToolTip.Show(tipInfo, pt);
}
}

Please refer to the attached sample for modification.
ModifiedGDBGSuperTooltip.zip

Best regards,
Haneef


AD Administrator Syncfusion Team February 6, 2007 11:10 AM UTC

Hi Haneef,

Thank you for your reply.

Well, I would like the position of the superTooltip to look a little more natural.
You handled MaxWidth property of SuperToolTip in the code above, but it doesn't seem to be the actual width of the superTooltip displayed by superTooltip.Show() method.
I would like to get the actual width of the superTooltip, to display just next to the cursor.
To get to the point, I want to do the followng:

private SuperToolTip sToolTip ;
void gridDataBoundGrid1_ActivateToolTip(object sender, GridActivateToolTipEventArgs e)
{
e.Cancel = true;
ToolTipInfo tipInfo = new ToolTipInfo();
tipInfo.BackColor = Color.Red;
tipInfo.Body.Image = SystemIcons.Information.ToBitmap();
tipInfo.Body.Text = e.Style.CellTipText +":::" + e.Style.Text ;

int tipWidth = sToolTip.GetActualWidth(tipInfo); // Get actual width of sToolTip displayed

if (MousePosition.X + tipWidth < this.Location.X + this.gridDataBoundGrid1.Size.Width)
{
sToolTip.Show(tipInfo, new Point(MousePosition.X + 15, MousePosition.Y));
}
else
{
Point pt = new Point(MousePosition.X - tipWidth, MousePosition.Y);
sToolTip.Show(tipInfo, pt);
}
}

Is it possible?


AD Administrator Syncfusion Team February 6, 2007 03:35 PM UTC

Hi Ichiro,

You can get the width of the supper tooltip using Body.GetPreferredSize() method. Please refer to the attached sample for more details.

int width = tipInfo.Body.GetPreferredSize(int.MaxValue,true).Width;

Sample: ModifiedGDBGSuperTooltip.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team February 7, 2007 05:35 AM UTC

Hi Haneef,

Thank you for your quick response.
Body.GetPreferredSize() method was exactly what I have needed!
By handling this method, I have accomplish to display superTooltip at the left side of the cursor, when a part of superTooltip is going to be shown out of screen.

Thank you so much for your advice.

Loader.
Live Chat Icon For mobile
Up arrow icon