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

dbl-click on the header border

Thread ID:

Created:

Updated:

Platform:

Replies:

35850 Oct 11,2005 10:22 PM UTC Oct 11,2005 11:36 PM UTC Windows Forms 3
loading
Tags: GridControl
Jim
Asked On October 11, 2005 10:22 PM UTC

I must be missing something obvious. I have a virtual grid, and when I dbl-click on the header border the column sizes to something very defaultish looking - the header text then gets wrapped. Shouldn''t it be looking at the header text and the length of the data in the visible rows? What additional work do I have to do to make that happen? I know about QueryColWidth but don''t understand what the point of it is - it gets fired constantly, even when a mouse moves over a column. Jim

Administrator [Syncfusion]
Replied On October 11, 2005 10:48 PM UTC

In a GridControl, when you double click the border between column headers, the grid reset teh column width to the default column size. If you want sme other behavior, then you can handle the ResizingColumns event. Here is a handler that will do a resizetofit on a double click.
private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
	if(e.Reason.Equals(GridResizeCellsReason.DoubleClick))
	{
		GridRangeInfo range = e.Columns; 
	this.gridControl1.Model.ColWidths.ResizeToFit(range, 
                			GridResizeToFitOptions.IncludeHeaders);
		e.Cancel = true;
	}
}

Jim
Replied On October 11, 2005 10:52 PM UTC

Ok, that looks like what I need, thanks. I just assumed that double-clicking would do a "best fit", but guess that was a bad assumption. :)

Jim
Replied On October 11, 2005 11:36 PM UTC

I optimized a bit: GridRangeInfo range = GridRangeInfo.Cells(0, e.Columns.Left, uiTraceGrid.ViewLayout.LastVisibleRow, e.Columns.Right);

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

;