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.

sizing child grid to fit window

Thread ID:

Created:

Updated:

Platform:

Replies:

10560 Feb 5,2004 11:25 AM Feb 6,2004 02:36 AM Windows Forms 7
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 5, 2004 11:25 AM

Hi, I have a parent grid that fits correctly within the window, but the child grid requires the user to scroll to the right to view all of the fields. Is there some way to: 1.Fit the child grid to the window 2.Exands all of the child columns to the max width allowable while still fitting the grid to the window. Thanks

Administrator [Syncfusion]
Replied On February 5, 2004 12:18 PM

Take a look at this sample. It uses the grid.Model.QueryColWidth event to proportionly size the grid columns as you size the grid. Syncfusion\Essential Suite\Grid\Samples\DataBound\GridDataBoundImageCell

Administrator [Syncfusion]
Replied On February 5, 2004 12:34 PM

Thanks, that worked partially, but now the column headings are being compressed to meet the new column sizes. Is there a way to have the column size to whatever is widest; heading or text? >Take a look at this sample. It uses the grid.Model.QueryColWidth event to proportionly size the grid columns as you size the grid. > >Syncfusion\Essential Suite\Grid\Samples\DataBound\GridDataBoundImageCell

Administrator [Syncfusion]
Replied On February 5, 2004 12:54 PM

If you use proportion sizing, you will likely see header text not fitting. So, another techique is to size the right-most column to fill up any empty space. This will let the default sizing (or explicit sizing if you want it) work for the other columns. You would also do this in QueryColWidth. Here is a forum link that discusses this. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=2699

Administrator [Syncfusion]
Replied On February 5, 2004 02:30 PM

Hi, I used the code in the example, and its not working. Here is the code I have: Private Sub GetColWidth(ByVal sender As Object, ByVal e As GridRowColSizeEventArgs) Dim fillLastColumn As Boolean = True If fillLastColumn AndAlso e.Index = Me.elementGrid2.Model.ColCount Then Dim width As Integer = IIf(Me.elementGrid2.Model.ColCount <= 0, 0, Me.elementGrid2.Model.ColWidths.GetTotal(0, Me.elementGrid2.Model.ColCount - 1)) e.Size = Me.elementGrid2.ClientRectangle.Width - width e.Handled = True End If The grid has 14 columns but the e.Index value never goes above ''2'' so the code does not run. Any help would be appreciated. >If you use proportion sizing, you will likely see header text not fitting. So, another techique is to size the right-most column to fill up any empty space. This will let the default sizing (or explicit sizing if you want it) work for the other columns. You would also do this in QueryColWidth. Here is a forum link that discusses this. > >http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=2699

Administrator [Syncfusion]
Replied On February 5, 2004 04:28 PM

Here is a sample. 10560_8253.zip

Administrator [Syncfusion]
Replied On February 5, 2004 05:17 PM

THanks for the sample, but I already tried that method. The problem is that the e.index value never goes above 2 and my grid colcount = 14. I''m not sure why this is, but any insight would be helpful >Here is a sample. >10560_8253.zip > >

Administrator [Syncfusion]
Replied On February 6, 2004 02:36 AM

Th reason e.Index never gets higher than 2 is that your client area will not hold 2 columns. If you want to see all the columns, no matter what the size of the client area, then you will have specially size each column down to some size that will allow all the columns to be visible in the given client area. One way to do this is to use the proportional sizing. The fillrightcolumn only makes sense if you know your client area is large enough to see all the columns. This means that it is likely you will not be able to see the full header text for every column. Exactly how you want to handle this is up to you. Wrap the headerText and do not change the row height? Wrap the heatertext and resize the row height so you see it all? Do not wrap the header text, clipping it instead? Or, something else? You can do any of these thing as well as other things, but fully seeing every header text on a single line is only possible if you make sure your client area is large enough to make this possible. Here is a sample showing the above options. 10560-1_1023.zip

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.

;