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

Setting width of GridListControl in ComboboxExt

Thread ID:





6468 Aug 13,2003 03:19 PM UTC Aug 13,2003 05:36 PM UTC WinForms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On August 13, 2003 03:19 PM UTC

Hi, I have a comboboxext with a grid list control (GLC) as the drop down listcontrol. My GLC have 3 or 4 columns. I want to have all my columns visible completely when dropped down. I could use combo.DropDownWidth to set the size. But how do I know how much it is? thanks, - Reddy

Administrator [Syncfusion]
Replied On August 13, 2003 04:22 PM UTC

One thing to try is int width = this.glc.Grid.Model.ColWidths.GetTotal(0,this.glc.Grid.Model.ColCount); to see if that will give you the size you need. You might need to turn off the FillRightColumn property as this may conflict with trying to explicilty size things.

Administrator [Syncfusion]
Replied On August 13, 2003 04:32 PM UTC

Clay, This is not taking the vertical scrollbar into consideration. How do I get the vertical scrollbar size? FYI, some how the GLC in GLC Grid cell type is sized exactly. I want to do the same thing for my combobox in a panel. thanks, - Reddy

Administrator [Syncfusion]
Replied On August 13, 2003 05:36 PM UTC

Here is the code the DropDown GridListControl uses.
int sbWidth = grid.VScroll ? SystemInformation.VerticalScrollBarWidth : 0;
int width = grid.ColWidths.GetTotal(0, grid.ColCount)+2;
if (width < grid.Width-sbWidth)
	grid.ColWidths[grid.ColCount] += grid.Width-sbWidth-width;               
sbWidth is the scrollbar width, width is the sum of the colwidths with a +2 fudge factor (for borders). This +2 might be what the previous code was missing. The if statement hadles the case when the sum of the columns is less than teh client width. In that case it makes teh right column the exact size to fill the client width.


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

Live Chat Icon For mobile
Live Chat Icon