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

Text trimming in gridControl cell / DisplayText length in pixels

Hi there, I implemented a virtual grid (GridControl) using Syncfusion Essential Grid v4.102.0.50. I want to show tooltips for each gridcell if the the mousepointer is hovering them AND only if the cells displayed text is trimmed to fit the cell bounds. I''m (re)setting the tooltips for each cell in the grids MouseMove event corresponding to this articel http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=67 It works fine except that I lack to see any way of getting the cells text rectangel or the text width in pixels itsself. I think I need this information to compare it with the actual cell width or column width and trigger the active-state of the tooltip. Any suggestions? Thanks! Yours Christian!

2 Replies

ST stanleyj Syncfusion Team March 3, 2006 10:32 AM UTC

Hi Christian, Hope this helps.. // In the GridControl''s MouseMove handler Graphics g = CreateGraphics(); GridStyleInfo style = this.gridControl1[row, col]; if( this.gridControl1.ColWidths[col] < g.MeasureString(style.Text, style.GdipFont).Width ) { this.toolTip1.SetToolTip(this.gridControl1, style.Text); this.toolTip1.Active = true; } g.Dispose(); Best regards, Stanley >Hi there, > >I implemented a virtual grid (GridControl) using Syncfusion Essential Grid v4.102.0.50. >I want to show tooltips for each gridcell if the the mousepointer is hovering them AND only if the cells displayed text is trimmed to fit the cell bounds. >I''m (re)setting the tooltips for each cell in the grids MouseMove event corresponding to this articel http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=67 > >It works fine except that I lack to see any way of getting the cells text rectangel or the text width in pixels itsself. >I think I need this information to compare it with the actual cell width or column width and trigger the active-state of the tooltip. > >Any suggestions? > >Thanks! > >Yours > >Christian!


DW dwedewdew March 3, 2006 02:56 PM UTC

Thanks a lot Stanley, that did the trick. Thanks! Yours Christian.

Loader.
Live Chat Icon For mobile
Up arrow icon