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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use tab key in the cell value

Thread ID:

Created:

Updated:

Platform:

Replies:

8112 Oct 21,2003 12:43 PM UTC Oct 21,2003 02:13 PM UTC WinForms 1
loading
Tags: GridControl
Patrick
Asked On October 21, 2003 12:43 PM UTC

I want to have tab indentation for the text in the cell. The grid doesn't seem to indent the text properly unless I am in edit mode of the cell. Any help?

Administrator [Syncfusion]
Replied On October 21, 2003 02:13 PM UTC

There is no support in the grid to handle this, so you would have to implement it yourself. There are several ways to try to do it. You could derive your own textbox cell control, and handle the static drawing by swapping out the tabs for spaces for you draw the string. Or if this is sufficient, a simpler technique would be to handle PrepareViewStyleInfo and swap out the tabs there.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.RowIndex != e.RowIndex || cc.ColIndex != e.ColIndex
		|| !cc.IsEditing)
	{
		string s = e.Style.Text;  
		s = s.Replace("\t", "            ");
		e.Style.Text = s; 
	}
}

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.

Warning Icon 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.Close Icon

;