2nd level and FrozenColumn

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?


4 Replies

JJ Jisha Joy Syncfusion Team April 20, 2009 08:54 AM UTC

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



S_ Stephane _ April 20, 2009 01:59 PM UTC

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



JJ Jisha Joy Syncfusion Team April 21, 2009 04:45 AM UTC

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



S_ Stephane _ April 28, 2009 08:07 PM UTC

Thanks!


Loader.
Up arrow icon