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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Handling the double click on header borders

Thread ID:

Created:

Updated:

Platform:

Replies:

68269 Sep 14,2007 03:46 AM UTC Sep 17,2007 11:38 AM UTC WinForms 1
loading
Tags: GridControl
Ben Fraser
Asked On September 14, 2007 03:46 AM UTC

Hello,

When the user double clicks on the header border the size of the column is reset to the default width by default.

I'd like to resize the column to be just large enough to fit the contents of all the cells in.

Is there an event I can add a handler to to do this?

Thanks,
Ben

Golda Rebecal [Syncfusion]
Replied On September 17, 2007 11:38 AM UTC

Hi Ben,

Sorry for the delay in responding.

You can make the column fit to text on resize double click by using the ResizeToFit method in the ResizingColumns event.

void gridControl1_ResizingColumns(object sender, Syncfusion.Windows.Forms.Grid.GridResizingColumnsEventArgs e)
{
if (e.Reason.Equals(GridResizeCellsReason.DoubleClick))
{
e.Cancel = true;

this.gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Cols(e.Columns.Left,e.Columns.Left));
}
}

Please try this and let me know if this helps you.

We appreciate your interest in Syncfusion products.

Best regards,
Golda

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

;