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.

double click to auto-size column

Thread ID:

Created:

Updated:

Platform:

Replies:

35134 Sep 23,2005 08:50 AM May 18,2017 05:48 AM Windows Forms 8
loading
Tags: GridControl
Lan Mo
Asked On September 23, 2005 08:50 AM

Hi, V3.2.1.0 For GGC, do you have any build-in fuction for double click a place between two columns'' header to make the column''s width auro-resized to what is the widest content?

Administrator [Syncfusion]
Replied On September 23, 2005 06:09 PM

This is available by default in version 3.3. Double click a header cell border, and the column will resize. If that doees not work in the version you are using, then you can handle the TableControlResizingColumns event and to the work yourself.
this.gridGroupingControl1.TableControlResizingColumns += new GridTableControlResizingColumnsEventHandler(gridGroupingControl1_TableControlResizingColumns);


private void gridGroupingControl1_TableControlResizingColumns(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlResizingColumnsEventArgs e)
{
	if(e.Inner.Reason == GridResizeCellsReason.DoubleClick)
	{
		e.TableControl.Model.ColWidths.ResizeToFit(e.Inner.Columns);
		e.Inner.Cancel = true;
	}
}

Lan Mo
Replied On September 25, 2005 11:25 AM

Thanks Clay. Do you know when or how I can get the V3.3? >This is available by default in version 3.3. Double click a header cell border, and the column will resize. > >If that doees not work in the version you are using, then you can handle the TableControlResizingColumns event and to the work yourself. > >
>this.gridGroupingControl1.TableControlResizingColumns += new GridTableControlResizingColumnsEventHandler(gridGroupingControl1_TableControlResizingColumns);
>
>
>private void gridGroupingControl1_TableControlResizingColumns(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlResizingColumnsEventArgs e)
>{
>	if(e.Inner.Reason == GridResizeCellsReason.DoubleClick)
>	{
>		e.TableControl.Model.ColWidths.ResizeToFit(e.Inner.Columns);
>		e.Inner.Cancel = true;
>	}
>}
>

Administrator [Syncfusion]
Replied On September 25, 2005 01:39 PM

You can download version 3.3 from your Direct Trac home page.

Catinat Velmourougan
Replied On September 29, 2005 04:37 AM

hi, I have the latest version (3.3) But this doesnt work. My grid resizes to width of the header and not to the width of the content. Should I set some options? regards, catinat

Administrator [Syncfusion]
Replied On September 29, 2005 07:38 AM

Hi Catinat, Can you see this behaviour in this attached sample? resizecolumn.zip Regards, Leo.

Catinat Velmourougan
Replied On September 29, 2005 08:07 AM

thanx

ajay murudkar
Replied On May 16, 2017 06:24 AM

Hi,

I want the resizecolumn.zip code, can you please send me the zip file.

Thanks,

Mohanraj Gunasekaran [Syncfusion]
Replied On May 18, 2017 05:48 AM

Hi Ajay, 

Thanks for your interest in Syncfusion product. 

By default, if you double click on the GridControl column header cell border, the column will resize automatically. Also, you can achieve this scenario by handling the ResizingColumns event. Please refer to the below code example and the sample, 

Code example 
this.gridControl1.ResizingColumns += gridControl1_ResizingColumns; 
 
void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e) 
{ 
    if (e.Reason == GridResizeCellsReason.DoubleClick) 
    { 
        if (e.Reason == GridResizeCellsReason.DoubleClick) 
        { 
            this.gridControl1.Model.ColWidths.ResizeToFit(e.Columns); 
            e.Cancel = true; 
        } 
    } 
} 
 
Sample link: GridControl 
 
Regards, 
Mohanraj G 
 


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.

;