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

Adjust the cell''s width to fix the cell value

Thread ID:





49481 Sep 20,2006 02:41 AM UTC Sep 20,2006 09:48 AM UTC WinForms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On September 20, 2006 02:41 AM UTC


i using the GridControl, how to i adjust the cell''s width to fix the cell value dynamcally?

Administrator [Syncfusion]
Replied On September 20, 2006 05:14 AM UTC

Hi Lim,

To resize the width of the column to fit the size of the text, you need to call the ResizeToFit method . Below is a code snippet.

//Resize the ColIndex depends on the cell( RowIndex , ColIndex);
grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Cell( RowIndex , ColIndex));

//Resize the both LeftColIndex and RightColIndex depend on the cells( TopRowIndex , LeftColIndex,,BottomRowIndex, RightColIndex);
grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Cells( TopRowIndex , LeftColIndex,,BottomRowIndex, RightColIndex));

//Resize the ColIndex depends on the all cell in the same column
grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Col( ColIndex));

Let me know if you are looking something different.

Best Regards,

Administrator [Syncfusion]
Replied On September 20, 2006 09:48 AM UTC


i am here to make my problem clearer..

my gridControl has a coveredRange of two column as below..

|___________| <-- Header one(Covered Range)
|_____|_____| <--- Header two

how to set the column 2 to resize to fit the cell value?

grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Col(2)); is not working in my grid..

please help


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