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

fit the width of collumn by double-click on collumn header

Thread ID:

Created:

Updated:

Platform:

Replies:

57690 Mar 8,2007 04:43 PM UTC Mar 9,2007 07:26 AM UTC WinForms 2
loading
Tags: GridControl
Daniel Dusek
Asked On March 8, 2007 04:43 PM UTC

Hi,
I want to fit the collumn-width when the user double-clicks on the header of the grid. So far I use this code:
private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
if (e.Reason == GridResizeCellsReason.DoubleClick)
{
if (e.Columns.IsCols == true)
{
gridControl1.ColWidths.ResizeToFit(e.Columns);
}
}
}

But this code does not work. What's wrong? Thank you, Dan

Administrator [Syncfusion]
Replied On March 8, 2007 06:21 PM UTC

Hi Dan,

You can try setting e.Cancel to true for DoubleClick reason in ResizingColumns event and let me know if this helps.

private void gridControl1_ResizingColumns(object sender, Syncfusion.Windows.Forms.Grid.GridResizingColumnsEventArgs e)
{
if (e.Reason == GridResizeCellsReason.DoubleClick)
{
if (e.Columns.IsCols == true)
{
gridControl1.ColWidths.ResizeToFit(e.Columns);
e.Cancel = true;
}
}
}

Best regards,
Haneef

Administrator [Syncfusion]
Replied On March 9, 2007 07:26 AM UTC

Hi Haneef,
yes it helped, thank you :-). Dan

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

;