Column Width ResizeToFit

Hi

Does anyone have any problems with the 'ResizeToFit' function. I have a code snippet from the onclick event that changes the orientation of the text in the header.

I initially draw the grid with the header text at an orientation of 270.

My problem is that on Orientating the text to 0 the resize is inconsistent and the column width is resized to different sizes with single words being wrapped over 2 or 3 lines?
i.e.
Adve
rse
Eve
nts
rather than Adverse Events
(see attachment).


if (row == 0)
{
// then is a column header
// change orientation of text
// either 0 (horizontal) or 270 (vertical)
// turn off read-only (temporarily)
syncGrid.IgnoreReadOnly = true;
syncGrid[row, col].Font.Orientation = ((syncGrid[row, col].Font.Orientation % 180) == 0) ? 270 : 0;
syncGrid.IgnoreReadOnly = false;
// resize column
syncGrid.Model.ColWidths.ResizeToFit(GridRangeInfo.Col(col),GridResizeToFitOptions.IncludeHeaders);
}

Can anyone let me know what I'm doing wrong?

Best Regards,

David

Header---resize.zip

4 Replies

AD Administrator Syncfusion Team October 30, 2006 06:08 AM UTC

Hi David,

Please refer to the following sample which demonstrates the ResizeToFit method in a Grid without any issues. Is it possible for you to modify the sample to reproduce the issue here?

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/ResizeToFit_a1508aae.zip

Best Regards,
Haneef


DH David Hook October 30, 2006 11:33 AM UTC

Hi Haneef

I have adjusted the sample code to reproduce the behavior I was experiencing in my application.

Please try clicking on the "Screening" column header multiple times. The Column gets resized to at least 3 different widths with text wrapping over up to 3 lines when the text orientation = 0.

Also, the "Completion" & "Unscheduled Visits" text get split over multiple lines
i.e.
Completio
n

and

Unschedul
ed Visits

How can I 'force' complete words to be shown so I see
Completion

and

Unscheduled
Visits
?

Thanks in advance.

Best Regards,

David

ResizeToFit2.zip


AD Administrator Syncfusion Team October 30, 2006 12:09 PM UTC

Hi David,

Try setting the WrapText property of the column header to false in a grid. Below is a code snippet

gridControl1[row, col].WrapText = false;

Here is a modified sample.
http://www.syncfusion.com/Support/user/uploads/ResizeToFit_6d1db900.zip

Regards,
Haneef


DH David Hook October 30, 2006 03:50 PM UTC

Thanks Haneef

Best Regards,

David

Loader.
Up arrow icon