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.

HowTo: limit static cell text to 1 line

Thread ID:





13061 Apr 19,2004 06:18 PM Apr 19,2004 11:53 PM Windows Forms 1
Tags: GridControl
Asked On April 19, 2004 06:18 PM

i have a databoundgrid and some of the columns (i.e. comments) contain multiple lines of text. the databoundgrid is used pretty much just for presentation. is it possible to limit the text output of a static cell type to only one line of output or is my only option going through the dataset parsing and replacing the text? TIA Peter

Administrator [Syncfusion]
Replied On April 19, 2004 11:53 PM

Are you using version 2.0? If yes, check out the DrawCellDisplayText event. It is called from any cell type before text is drawn and lets you replace the default drawing of text with your DrawString call. You could for example call e.Graphics.DrawString(displayText, e.Style.GdipFont, new SolidBrush(e.Style.TextColor), e.TextRectangle); and e.Cancel = true; The displayText can be the text and you can modify it before it gets drawn. Another alternative that also work with 1.6 would be to handle the QueryCellFormattedText. In that event handler you could replace the text to be displayed in the cell before it gets drawn. Stefan


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.