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

adjust the height and width of a cell in datagrid

Thread ID:

Created:

Updated:

Platform:

Replies:

17442 Aug 9,2004 10:39 AM Aug 10,2004 07:35 AM Windows Forms 6
loading
Tags: GridControl
Shri
Asked On August 9, 2004 10:39 AM

hi I have a textbox with multiline = true and wrap = true with maxSize = 2000 Now this data is being saved into a cell of a datagrid I need to adjust the height and width of the cell(of datagrid) accordingly Can Some One Help me thanks Shri

Administrator [Syncfusion]
Replied On August 9, 2004 11:24 AM

To programatically size the row heights and colwidth, you call grid.Model.RowHeights.ResizeToFit and grid.Model.ColWidths.ResizeToFit. (If you are trying to do this from a point when the grid is not visibl, say in FormLoad, you should also set grid.AllowResizeToFit = false.)

Shri
Replied On August 9, 2004 12:37 PM

hi, Thanks! can i set minimum column size(width) so that when it auto resizes the column it doesnt go down certain value Shri

Administrator [Syncfusion]
Replied On August 9, 2004 01:31 PM

There is a GridResizeToFitOption.NoShrink flag you can pass when you call grid.Model.ColWidths.ResizeToFit to prevent the size from decreasing, but I do not think this is what you asked about when you mentioned mimum size. To impose a Minimum size, you would have to first call grid.Model.ResizeToFit and then have code like: Me.Grid.Model.ColWidths[3] = Math.Max(Me.Grid.Model.ColWidths[3], someMinValue) If it flickers too much, you can add a grid.BeginUpdate before you do teh resizing, and a grid.EndUpdate followed by grid.Refresh after the sizing code.

Shri
Replied On August 9, 2004 03:08 PM

hi, its working fine except the wrap property ie., if the user has not used the "Enter" key during input into the textbox.... and if the input is one long line then it should wrap itself at the max length of the cell and appear in the next line i tried other ways too but this is not working any suggestions thanks Shri

Administrator [Syncfusion]
Replied On August 9, 2004 04:58 PM

If you drag the row height larger, you should be able to see the multiple lines if you have style.WrapText = true. If you want to have the cell height autosize as you type into the cell, then try setting the style.AutoSize = true for that column.

Administrator [Syncfusion]
Replied On August 10, 2004 07:35 AM

thanks Shri

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.

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.

;