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.

resize DBG when data is smaller than grid

Thread ID:

Created:

Updated:

Platform:

Replies:

38671 Dec 15,2005 05:51 PM Dec 15,2005 07:02 PM Windows Forms 1
loading
Tags: GridControl
va
Asked On December 15, 2005 05:51 PM

I have a databound grid about 400 pixels wide. I have t columns that are at most 100 pixels wide. RsizetoFit just resizes the columns to the largest width of each column (whih is 100 each) I want to have the DataBound columns equally fill the whole table width. how do I do this?

Administrator [Syncfusion]
Replied On December 15, 2005 07:02 PM

You can use code similar to the code below to set these colwidths.
int width = (grid.ClientSize.Width - grid.Model.ColWidths[0]) / grid.Model.ColCount;

for(int i = 1; i <= grid.Model.ColCount; ++i)
{
   grid.Model.ColWidths[i] = width;
}
Or if you want to do it dynamically through an event, you can use the grid.Model.QueryColWidth event. There if e.Index > 0, you set e.Size = width (as calculated above) and e.Handled = true. You can see code similar to this in the \Essential Studio\3.3.0.0\Windows\Grid.Windows\Samples\DataBound\GridDataBoundImageCell sample.

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.

;