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.
Unfortunately, activation email could not send to your email. Please try again.

Display Truncated Numeric as "######"

Thread ID:

Created:

Updated:

Platform:

Replies:

19211 Sep 21,2004 07:15 AM Oct 5,2004 11:18 AM Windows Forms 3
loading
Tags: GridControl
Scott Numbers
Asked On September 21, 2004 07:15 AM

Hello, I have an application that uses the SyncFusion GridControl (Not Bound Grid) that has many columns of financial data. When values that are too big to display in the set column width they are truncated. In many cases, it is next to impossible to know that the visual data is not complete. I have looked through many of the properties for the GridCOntrol and did not find anything that looks like it would help. I did see the example in the knowledege base about haow to display elipsis on a Bound Data Grid but I would rather show "#######" instead. Anybody have a clue on how to achieve this? Thank you for your time and attention in advance, Scott #s

Administrator [Syncfusion]
Replied On September 21, 2004 07:53 AM

Scott, I accomplished this by creating my own custom cell, overriding the draw method and measuring the text before calling DrawString. If the text does not fit, modify (with #''s) before calling DrawString. You can probably find a custom cell example in the Syncfusion examples. To speed things up, you can store the modified text and reset this variable based on column width change events, for example. Good Luck. Steve

Administrator [Syncfusion]
Replied On September 21, 2004 08:56 AM

One event that works for any cell type (so you don''t have to derive a cell type) is the DrawCellDisplayText event. From within that event you can call the static GridStaticCellRenderer.DrawText method and afterwards set e.Cancel = true to prevent the grid from calling GridStaticCellRenderer.DrawText again when the event returns. Stefan

Scott Numbers
Replied On October 5, 2004 11:18 AM

Thanks for the response. I used the Grid_DrawCell Event and it did the trick. This event was good because it provided easy access to the cell contents, the cell rectangle and a graphics object to do the measurement. Brief Sample: SizeF sz = e.Graphics.MeasureString(e.Style.CellValue.ToString(), mNumericFont); if ((sz.Width + 2) > e.Bounds.Width) { e.Style.CellValue = "################"; } Thanks again. >One event that works for any cell type (so you don''t have to derive a cell type) is the DrawCellDisplayText event. > >From within that event you can call the static GridStaticCellRenderer.DrawText method and afterwards set e.Cancel = true to prevent the grid from calling GridStaticCellRenderer.DrawText again when the event returns. > >Stefan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;