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.

2nd level and FrozenColumn

Thread ID:

Created:

Updated:

Platform:

Replies:

80622 Apr 17,2009 09:29 AM Apr 28,2009 04:07 PM Windows Forms 4
loading
Tags: Grouping
Stephane _
Asked On April 17, 2009 09:29 AM

If I add this
Me.gridGroupingControl1.TableModel.Cols.FrozenCount = 2
Me.gridGroupingControl1.TableModel.Cols.HeaderCount = 2

To the grouping sample

Syncfusion\EssentialStudio\5.2.0.25\Windows\Grid.Grouping.Windows\Samples\2.0\Grouping\Grouping

I get a weird behavior where half of the second level group title name is moving with the scrollbar.
Do you know who I can fix this?


Jisha Joy [Syncfusion]
Replied On April 20, 2009 04:54 AM

Hi Stephane,

Please try increasing the column width of first column to see if this helps.

this.gridGroupingControl1.TableDescriptor.Columns[0].Width =225;

Please let me know if this helps.

Regards,
Jisha


Stephane _
Replied On April 20, 2009 09:59 AM

It works but the first column is awkwardly large. Is this the only option?


Jisha Joy [Syncfusion]
Replied On April 21, 2009 12:45 AM

Hi Stephane,

You need to handle the TableControlDrawCell event and draw the GridCaption cell text using DrawString method. Please see the code:

// In form Load

this.gridGroupingControl1.TableControl.EnableDoubleBufferSurface();

this.gridGroupingControl1.TableControl.HScrollPixelPosChanged += new GridScrollPositionChangedEventHandler(HScrollPixelPosChanged);
this.gridGroupingControl1.TableControlDrawCell += new GridTableControlDrawCellEventHandler(TableControlDrawCell);

// event handlers

private void TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;

if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
{
Console.WriteLine(e.Inner.Style.Text);
e.Inner.Cancel = true;
string s = e.Inner.Style.Text;
e.Inner.Style.Text = string.Empty;

Rectangle rect = e.Inner.Bounds;
rect.Location = new Point(0, rect.Y);

e.Inner.Renderer.Draw(e.Inner.Graphics, e.Inner.Bounds, e.Inner.RowIndex, e.Inner.ColIndex, e.Inner.Style);
e.Inner.Graphics.DrawString(s, e.Inner.Style.GdipFont, new SolidBrush(e.Inner.Style.TextColor), rect);

e.Inner.Style.Text = s;
}
}

private void HScrollPixelPosChanged(object sender, GridScrollPositionChangedEventArgs e)
{
GridTableControl tc = sender as GridTableControl;
tc.RefreshRange(GridRangeInfo.Table());
}

Please let me know if this helps.

Regards,
Jisha


Stephane _
Replied On April 28, 2009 04:07 PM

Thanks!


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.

;