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

Expanding col zero if resolution gets bigger

Thread ID:





74519 Jun 17,2008 02:12 PM UTC Jun 23,2008 07:11 PM UTC WinForms 7
Tags: GridControl
Administrator [Syncfusion]
Asked On June 17, 2008 02:12 PM UTC

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.



Administrator [Syncfusion]
Replied On June 20, 2008 01:32 PM UTC

Any ideas on this?

Administrator [Syncfusion]
Replied On 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.

Maybe something like this will serve your needs.

Administrator [Syncfusion]
Replied On 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?

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On June 23, 2008 07:05 PM UTC

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

Administrator [Syncfusion]
Replied On 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.


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