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

ResizeToFit Column Headers (Row(0))

Thread ID:

Created:

Updated:

Platform:

Replies:

4562 May 19,2003 10:38 AM UTC May 22,2003 01:26 PM UTC WinForms 6
loading
Tags: GridControl
Robert Hughes
Asked On May 19, 2003 10:38 AM UTC

I'm trying to auto resize the height of the column header in a bound grid where I'm specifying the column widths and things seem not to be working as I'd anticipated. I'm using the following code to attempt my resize. It has no effect. this.MyGrid.Model.RowHeights.ResizeToFit(GridRangeInfo.Row(0)); I've also tried including various GridResizeToFitOptions with no success. Curiously when I explicitly define the row height using the following code things work fine. this.MyGrid.Model.RowHeights[0] = 50; Any assistance would be most gratefully recieved. Many thanks, Rob Hughes

Administrator [Syncfusion]
Replied On May 19, 2003 12:59 PM UTC

> I'm trying to auto resize the height of the column header in a bound grid where I'm specifying the column widths and things seem not to be working as I'd anticipated. > > I'm using the following code to attempt my resize. It has no effect. > this.MyGrid.Model.RowHeights.ResizeToFit(GridRangeInfo.Row(0)); > > I've also tried including various GridResizeToFitOptions with no success. > > Curiously when I explicitly define the row height using the following code things work fine. > this.MyGrid.Model.RowHeights[0] = 50; > > Any assistance would be most gratefully recieved. > > Many thanks, > Rob Hughes You do need to include the IncludeHeaders option. Also, you should turn off the AllowResizeToFit so that does not affect things. this.gridDataBoundGrid1.AllowResizeToFit = false; this.gridDataBoundGrid1.Model.RowHeights.ResizeToFit(GridRangeInfo.Row(0), GridResizeToFitOptions.IncludeHeaders);

Robert Hughes
Replied On May 21, 2003 08:13 AM UTC

Thanks Clay. Unfortunately though this doesn't seem to be working for me. Could there be anything else which is preventing this from happening ? (I didn't mention originally but this grid is bound and within a navigator control.) As mentioned though, if I replace this auto-resize code with an explicit sizing it does take effect, however the auto-resizing itself in the same code position seems to have no effect. To check that no code is resetting this sizing for debugging purposes I've put a button on my form which calls the two suggested lines of code. This also has no effect. Any further suggestions would be very welcome. Many thanks, Rob

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

Are you handling any events that might affect colwidths such as QueryColWidth? What version of the grid are you using? The latest public release is 1.5.2.0 which is available from your support home page on our website. (Not available to eval copies.) If you can post a sample here showing teh problem, we can look into it. Or, you can also create a Direct Trac support incident and submit a sample there is you would like.

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

Sorry, should have asked about QueryRowHeights, not col widths. Attached is a little sample that seems to work as expected for me. Does it not work for you?

Robert Hughes
Replied On May 22, 2003 11:11 AM UTC

Thanks once again Clay. I'm unable to download your code due to restrictions at the site I'm working at but will do so when I'm home. Just for the record though I am using version 1.5.2.0. Also, and I don't know why I hadn't stumbled across this before, if I replace the line this.MyGrid.Model.RowHeights.ResizeToFit(GridRangeInfo.Row(0)) with this.MyGrid.Model.Rows.Size.ResizeToFit(GridRangeInfo.Row(0)) then I manage to achieve what I'm after. So ultimately my problem is resolved. I'm still curious though why the former doesn't work but the latter does. Thanks once again for your help. Rob

Robert Hughes
Replied On May 22, 2003 01:26 PM UTC

Can I withdraw that last statement please ? I thought things had been resolved but apparently not. My grid is being used in a generic results screen of an SQL generator. In certain instances the resize works but not in others. Most bizarre, considering the fact that the same grid definition code is being run at all times. At no point am I handling any grid display events except for the Resize which does the following this.MyGrid.BeginUpdate(); this.MyGrid.Refresh(); this.MyGrid.EndUpdate(); to repaint. Any thoughts ? Thanks Rob

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

;