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.

displaying/editing with embedded tabs in databoundgrid

Thread ID:

Created:

Updated:

Platform:

Replies:

15920 Jun 30,2004 09:55 AM Jul 1,2004 12:04 PM Windows Forms 4
loading
Tags: GridControl
James A Frisby(For EPS - Computer Software)
Asked On June 30, 2004 09:55 AM

I''m evaluating essential grid for a data project I''m working on. One problem I''ve found, occurs when text in the database contains embedded tab characters. After the data is loaded into the grid, i run the .Model.RowHeights.ResizeToFit process on the grid. When the text is presented in the grid, each tab takes a single space, however when you click in the cell to edit it, the tabs expand to read correctly. Is there a way to set the grid so it shows the tabs expanded at display time as well as during cell edit? Thanks Jim Frisby

Administrator [Syncfusion]
Replied On June 30, 2004 12:18 PM

There is no property setting to handle this. One thing you can do is to handle the DrawDisplayText event and draw the text yourself in a way that shows the tabs. For example, you can draw it as Richtext.
private RichTextBox rtb = new RichTextBox();
private void gridDataBoundGrid1_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
	if(e.Style.CellIdentity.ColIndex == 2) //use for column 2
	{
		rtb.Clear();
		rtb.SelectedText = e.DisplayText;
		string rtf = rtb.Rtf;
		Syncfusion.Drawing.RichTextPaint.DrawRichText(e.Graphics, rtb, rtf, this.gridDataBoundGrid1.PrintingMode, this.gridDataBoundGrid1.GridBounds, e.TextRectangle, 
this.gridDataBoundGrid1.GridBounds, e.Style.BackColor, e.Style.WrapText, 100, false);
		e.Cancel = true;
	}
}
Depending upon the version of the grid you are using, the DrawRichText method shown above may give a syntax error. If so, try removing the last argument.

James A Frisby(For EPS - Computer Software)
Replied On June 30, 2004 02:18 PM

Clay, Your suggestion makes the tabs show correctly, but curiously, since I''m using "Model.RowHeights.ResizeToFit", it now formats the height such that the last line of the text doesn''t show anymore. Jim >There is no property setting to handle this. > >One thing you can do is to handle the DrawDisplayText event and draw the text yourself in a way that shows the tabs. For example, you can draw it as Richtext. > >
>private RichTextBox rtb = new RichTextBox();
>private void gridDataBoundGrid1_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
>{
>	if(e.Style.CellIdentity.ColIndex == 2) //use for column 2
>	{
>		rtb.Clear();
>		rtb.SelectedText = e.DisplayText;
>		string rtf = rtb.Rtf;
>		Syncfusion.Drawing.RichTextPaint.DrawRichText(e.Graphics, rtb, rtf, this.gridDataBoundGrid1.PrintingMode, this.gridDataBoundGrid1.GridBounds, e.TextRectangle, 
>this.gridDataBoundGrid1.GridBounds, e.Style.BackColor, e.Style.WrapText, 100, false);
>		e.Cancel = true;
>	}
>}
>
> >Depending upon the version of the grid you are using, the DrawRichText method shown above may give a syntax error. If so, try removing the last argument.

Administrator [Syncfusion]
Replied On June 30, 2004 03:38 PM

I do not have a simple solution for this problem. The sizing algorithm is using the same strings as the orignal problem you described, and thus, does not use the tab in the string.

James A Frisby(For EPS - Computer Software)
Replied On July 1, 2004 12:04 PM

Ok, thanks

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.

;