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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Column Width ResizeToFit

Thread ID:

Created:

Updated:

Platform:

Replies:

51104 Oct 27,2006 01:30 PM UTC Oct 30,2006 03:50 PM UTC WinForms 4
loading
Tags: GridControl
David Hook
Asked On October 27, 2006 01:30 PM UTC

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

Administrator [Syncfusion]
Replied On 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

David Hook
Replied On 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

Administrator [Syncfusion]
Replied On 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

David Hook
Replied On October 30, 2006 03:50 PM UTC

Thanks Haneef

Best Regards,

David

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

;