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

how to customize nested table GridGroupContrl to looks like TreeView (look & feel)

Thread ID:

Created:

Updated:

Platform:

Replies:

79861 Mar 2,2009 02:29 PM UTC Mar 4,2009 12:54 PM UTC WinForms 3
loading
Tags: GridControl
David Cui
Asked On March 2, 2009 02:29 PM UTC


hi, any example or way of customize the nested table as data sources' GGC looks like TreeView presentatio ?

best,

david


Nisha Arockiya A [Syncfusion]
Replied On March 3, 2009 12:36 PM UTC

Hi David,

Thanks for your interest in Syncfusion Products.

You can handle TableControlDrawCell event to customise the nested Table.

Code Snippet:


void gridGroupingControl1_TableControlDrawCell(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell
|| style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell)
{
e.Inner.Cancel = true;
Point pt = e.Inner.Bounds.Location;
pt.Offset(e.Inner.Bounds.Width/2 -2 ,e.Inner.Bounds.Height/2 - 2);
Rectangle rect =new Rectangle(pt,new Size(9,9));
e.Inner.Graphics.DrawRectangle(Pens.Black, rect);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;

e.Inner.Graphics.DrawString(e.Inner.Style.Description, e.Inner.Style.GdipFont,new SolidBrush(e.Inner.Style.TextColor),rect,format);
}
}


Here is the sample:


http://files.syncfusion.com/samples/Grid.Windows/F79861/main.htm


Let me know if this serve your needs.

Regards,
Nisha.


David Cui
Replied On March 3, 2009 04:05 PM UTC


Nisha,

it does work. Thanks.

but somehow, it doesn't look decent as default windows or sncfustion treeview ... , say the tree lines , ...

I am not good at graphic drawing, any other good example ?

David

>Hi David,

Thanks for your interest in Syncfusion Products.

You can handle TableControlDrawCell event to customise the nested Table.

Code Snippet:


void gridGroupingControl1_TableControlDrawCell(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell
|| style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell)
{
e.Inner.Cancel = true;
Point pt = e.Inner.Bounds.Location;
pt.Offset(e.Inner.Bounds.Width/2 -2 ,e.Inner.Bounds.Height/2 - 2);
Rectangle rect =new Rectangle(pt,new Size(9,9));
e.Inner.Graphics.DrawRectangle(Pens.Black, rect);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;

e.Inner.Graphics.DrawString(e.Inner.Style.Description, e.Inner.Style.GdipFont,new SolidBrush(e.Inner.Style.TextColor),rect,format);
}
}


Here is the sample:


http://files.syncfusion.com/samples/Grid.Windows/F79861/main.htm


Let me know if this serve your needs.

Regards,
Nisha.




Nisha Arockiya A [Syncfusion]
Replied On March 4, 2009 12:54 PM UTC

Hi David,

Thanks for the Update.

Please refer to the browser sample on GDBG Tree Lines Demo in the following path.

\My Documents\Syncfusion\EssentialStudio\7.1.0.20\Windows\Grid.Windows\Samples\2.0\Data Bound\Hierarchical\GDBG Tree Lines Demo

This sample illustrates the display of a hierarchical grid with tree lines and indented text in the first column. To achieve this, you must set the GridDataBoundGrid.ShowTreeLines property to true.

Let me know if this helps.

Regards,
Nisha.


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.

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

;