how to customize nested table GridGroupContrl to looks like TreeView (look & feel)
hi, any example or way of customize the nested table as data sources' GGC looks like TreeView presentatio ?
best,
david
SIGN IN To post a reply.
3 Replies
NA
Nisha Arockiya A
Syncfusion Team
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:
Here is the sample:
http://files.syncfusion.com/samples/Grid.Windows/F79861/main.htm
Let me know if this serve your needs.
Regards,
Nisha.
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.
DC
David Cui
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.
NA
Nisha Arockiya A
Syncfusion Team
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.
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.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DC David Cui
- Mar 2, 2009 02:29 PM UTC
- Mar 4, 2009 12:54 PM UTC