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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Grouping Control

Thread ID:





49618 Sep 22,2006 04:05 AM UTC Sep 22,2006 09:20 AM UTC WinForms 1
Tags: Grouping
Asked On September 22, 2006 04:05 AM UTC

is there a way to freeze the grouping grid caption text when scrolling to the right.


Administrator [Syncfusion]
Replied On September 22, 2006 09:20 AM UTC

Hi Prem,

Yes. You need to handle the TableControlDrawCell event and draw the GridCaption cell text using DrawString method. Below is a code snippet

//Form Load.
this.grid.TableControl.HScrollPixelPosChanged +=new GridScrollPositionChangedEventHandler(HScrollPixelPosChanged);

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

if( style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell
&& e.Inner.ColIndex ==0 && e.TableControl.TableDescriptor.Name == "ParentTable" )
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;




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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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