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. Image for the cookie policy date

Expanding col zero if resolution gets bigger

I got the following code from you awhile back on how to expand the last col in a grid to make it fill the screen if the resolution changed and if I was using anchoring. Here is the code.

Private fillLastColumn As Boolean = True

Private Sub GridControl1_QueryColWidth(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs) Handles GC1.QueryColWidth
''This sub allows col 8 to resize to fit the entire gc1.clientrectangle. This was added when we removed the resizer because it added a huge gray empty
''space at the end of the grid in a larger resolution like 1600x900.
If Me.fillLastColumn AndAlso e.Index = GC1.ColCount - 1 Then
Dim width As Integer = CInt(IIf(GC1.ColCount <= 0, 0, GC1.ColWidths.GetTotal(0, GC1.ColCount - 2)))
''The 295 is the original size that Craig set col 8 to be. The if below is needed so that at a lower resolution like 1024x768, that it wont
''chop off the end of col 8 when it resizes it to fit.
If GC1.ClientRectangle.Width - width < 295 Then
Exit Sub
End If
e.Size = GC1.ClientRectangle.Width - width
e.Handled = True
End If

End Sub

Now I would like the opposite of this. I would like col zero to expand if the user makes their resolution say from 1024 to 1600. I've tried changing what I think I should and can not make it work. What do I need to changed to make it always make col zero expand to what it needs to be.

Thanks

Phil



7 Replies

AD Administrator Syncfusion Team June 20, 2008 01:32 PM UTC

Any ideas on this?



AD Administrator Syncfusion Team June 21, 2008 06:23 PM UTC

Here is a different way to have a fill column in a flat GridGroupingControl. You can specify the name of the column you want to use as the fill column. It can be any column, the first one or the last one or any in between.
http://www.syncfusion.com/support/user/uploads/GGC_FillColumn_d3acb160.zip

Maybe something like this will serve your needs.



AD Administrator Syncfusion Team June 23, 2008 02:21 PM UTC

I guess I forgot to tell you we are stuck at versin 4.202 and I can't build your app. I am guessing because I see you are using version 6 it looks like?



AD Administrator Syncfusion Team June 23, 2008 05:49 PM UTC

I do not have 4.2 installed on my system, but I do have 4.1 installed. It builds fine with 4.1, so I expect it should build OK with 4.2. You do have to remove the Syncfusion 6.3 references, and add the 4.2 Syncfusion references.



AD Administrator Syncfusion Team June 23, 2008 06:10 PM UTC

I had changed all the refernces but I dont think one got added back in the first time I did it. Now it is working for me. Is this one of your samples that ships with your product that I could find a VB version of? If not I will just convert it myself.



AD Administrator Syncfusion Team June 23, 2008 07:05 PM UTC

Can I do this with a regular gridcontrol and not a gridgroupingcontrol?



AD Administrator Syncfusion Team June 23, 2008 07:11 PM UTC

No, this code is not from a sample.

No, you can only use it in a GridGroupingControl because that is the only grid that has TableDescriptor.Columns[].Width properties.

In a GridControl, you could try to do something similar using grid.ColsWidths, but you cannot use Column names as there are no column names in a GridControl.


Loader.
Live Chat Icon For mobile
Up arrow icon