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

Row Height Auto Resize with TextWrap

Thread ID:





2923 Feb 20,2003 03:43 AM UTC Feb 21,2003 09:09 AM UTC WinForms 3
Tags: GridControl
Adrian Launchbury
Asked On February 20, 2003 03:43 AM UTC

I have noticed a weird behaviour when a user enters multiple lines of text in a cell that has been set-up to allow auto resize and text wrapping. On the first line, wrapping to the second, the cell height changes only very slightly, like 1px, the first line disappears upwards, and the second line is in the position of the first line. From the second to third, and subsequent lines, the cell height changes correctly, displaying the previous line, as well as creating a new line. Why is there a problem with just the first line? Thanks, Adrian.

Administrator [Syncfusion]
Replied On February 20, 2003 12:35 PM UTC

I think this is a bug that we will have to fix in our source. Here is a CurrentCellKeyPress event handler that you can try. Maybe it will give you better results than you are getting now.
private void gridControl1_CurrentCellKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	GridStyleInfo style = this.gridControl1[cc.RowIndex, cc.ColIndex];
	if(style.AutoSize && style.WrapText)
		GridRangeInfo range = GridRangeInfo.Cell(cc.RowIndex, cc.ColIndex);
		int nOldHeight = this.gridControl1.GetRowHeight(cc.RowIndex);
		this.gridControl1.RowHeights.ResizeToFit(range, GridResizeToFitOptions.NoShrinkSize|GridResizeToFitOptions.ResizeCoveredCells);
		if(this.gridControl1.GetRowHeight(cc.RowIndex) != nOldHeight)

Adrian Launchbury
Replied On February 21, 2003 03:28 AM UTC

Ok that worked a bit better, but I noticed that for each progressively wrapped line, the cell height resizes earlier and earlier. As a specific example, it will change the row height three characters earlier than the actual end of the line on the fourth wrapped line. Also when using the enter key to wrap onto a new line (first time only), it still rolls the text up instead of onto a new line. Though it does seem to create a new spare empty line after entering the second character on the previous line (delayed?) Also the ConfirmChanges() function doesn’t take an argument, so how did you compile your example, do you have a different version? I am using version

Administrator [Syncfusion]
Replied On February 21, 2003 09:09 AM UTC

I am using the public patch available from your support home page.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon