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

Resize grid to window size

Thread ID:

Created:

Updated:

Platform:

Replies:

11002 Feb 19,2004 11:42 AM UTC Feb 23,2004 05:33 AM UTC WinForms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 19, 2004 11:42 AM UTC

The grid control is the only control I have on the form. I want the grid control to fill the form. I have set dock style to fill but when I run it doesn''t resize to fill the window. What else do I have to do to make a grid fill the form?

Administrator [Syncfusion]
Replied On February 19, 2004 11:55 AM UTC

Docking the grid in a form will only change the grid''s clientarea/bounds as you size the form. If you want the column widths and row heights to change so the whole client area of the grid is occupied by grid cells, then you should handle the QueryRowHeights and QueryColWidths events and dynamically set the height/width of the requested row/column based on the clientsize. Take a look at this sample, Syncfusion\Essential Suite\Grid\Samples\DataBound\GridDataBoundImageCell. It shows the grid dynamically changing colwidths/rowheights as you size the form.

Administrator [Syncfusion]
Replied On February 23, 2004 12:56 AM UTC

Thanks for the pointer. This helped a lot. The only issue with column resizing I haven''t been able to get working is by default a column can be hidden from view by dragging its width to 0, how can I prevent this but still let the user resize a column? I would also not like them to be able to resize a column so that the scroll bar would have to be used to view the column. thanks >Docking the grid in a form will only change the grid''s clientarea/bounds as you size the form. If you want the column widths and row heights to change so the whole client area of the grid is occupied by grid cells, then you should handle the QueryRowHeights and QueryColWidths events and dynamically set the height/width of the requested row/column based on the clientsize. > >Take a look at this sample, Syncfusion\Essential Suite\Grid\Samples\DataBound\GridDataBoundImageCell. It shows the grid dynamically changing colwidths/rowheights as you size the form.

Administrator [Syncfusion]
Replied On February 23, 2004 05:33 AM UTC

If you want to prevent your user from sizing a column to width zero, then you can cancel the resize by handling the RsizingColumns event.
private void gridDataBoundGrid1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
	if(e.Reason == GridResizeCellsReason.MouseUp && e.Width < 1)
		e.Cancel = true;
}	

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.

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

;