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.

Handling the double click on header borders

Thread ID:

Created:

Updated:

Platform:

Replies:

68269 Sep 13,2007 11:46 PM Sep 17,2007 07:38 AM Windows Forms 1
loading
Tags: GridControl
Ben Fraser
Asked On September 13, 2007 11:46 PM

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 07:38 AM

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.

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.

;