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. Image for the cookie policy date

double click to auto-size column

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?

8 Replies

AD Administrator Syncfusion Team September 23, 2005 10:09 PM UTC

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;
	}
}


LM Lan Mo September 25, 2005 03:25 PM UTC

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;
>	}
>}
>


AD Administrator Syncfusion Team September 25, 2005 05:39 PM UTC

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


CV Catinat Velmourougan September 29, 2005 08:37 AM UTC

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


AD Administrator Syncfusion Team September 29, 2005 11:38 AM UTC

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


CV Catinat Velmourougan September 29, 2005 12:07 PM UTC

thanx


AM ajay murudkar May 16, 2017 10:24 AM UTC

Hi,

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

Thanks,


MG Mohanraj Gunasekaran Syncfusion Team May 18, 2017 09:48 AM UTC

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 
 


Loader.
Live Chat Icon For mobile
Up arrow icon