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.

Grid Grouping Control

Thread ID:

Created:

Updated:

Platform:

Replies:

49618 Sep 22,2006 12:05 AM Sep 22,2006 05:20 AM Windows Forms 1
loading
Tags: Grouping
Prem
Asked On September 22, 2006 12:05 AM

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

thanks
prem

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

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;
tc.RefreshRange(GridRangeInfo.Row(1));
}

Thanks,
Haneef

GGCCaptioncellDraw.zip

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.

;