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.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

57690 Mar 8,2007 11:43 AM Mar 9,2007 02:26 AM Windows Forms 2
loading
Tags: GridControl
Daniel Dusek
Asked On March 8, 2007 11:43 AM

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 01:21 PM

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 02:26 AM

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.

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.

;