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.
Syncfusion Feedback

GGC ResizeToFit when grouped on form_load

Thread ID:





37738 Nov 29,2005 10:51 AM Nov 29,2005 01:09 PM Windows Forms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On November 29, 2005 10:51 AM

I am having a problem with ResizeToFit if I add grouped columns in form_load. If I include these statements: .GroupedColumns.Add("Status",ListSortDirection.Descending) .GroupedColumns.Add("LastActivityDateAsDate", ListSortDirection.Ascending) This resizetofit call resizes badly: .ColWidths.ResizeToFit(GridRangeInfo.Table.ExpandRange(1, 1, .RowCount, .ColCount),GridResizeToFitOptions.None) I''ve tried different resizetofitoptions but none seem to make a difference. The same statement resizes correctly if the grid is loaded ungrouped and the user groups it. I am calling resizetofit in the FormSizeChanged and CategorizedRecords events. Is there anyway to add grouped columns later than at the end of form_load? Thanks, Dave Erwin

Administrator [Syncfusion]
Replied On November 29, 2005 11:50 AM

>>Is there anyway to add grouped columns later than at the end of form_load? At the end of form.load, you can create a Timer with a small interval and a Tick event. In the event handler, stop the timer, unsubscribe to the event and do the grouping there.
//At the bottom of form.load
Timer t = new Timer();
t.Interval = 20;
t.Tick += new EventHandler(t_Tick);

//the handler
private void t_Tick(object sender, EventArgs e)
	Timer t = sender as Timer;
	t.Tick -= new EventHandler(t_Tick);

	//do your grouping and sizing;

Administrator [Syncfusion]
Replied On November 29, 2005 12:27 PM

Thanks, I''ll give that a try. Is there a reason why resizetofit behaves this way? Dave Erwin

Administrator [Syncfusion]
Replied On November 29, 2005 01:09 PM

The GridGroupingControl has does its own resizing the very first time the grid is about to be drawn. I suspect this resizing is stepping on the resizing you are trying to do.


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