Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Hierarchical columns with images

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Hierarchical columns with images
Link Posted: 24-Dec-2005 20:59
hello,

if i have two Hierarchical columns in a grid and i want to dispaly data and images in both of them, in a treeview display.

how can i do that?

i can make it work only with one column

thanks,
Guy
Link Posted: 24-Dec-2005 21:20
May be it will better if you will use ImageColumn to display additional images?
If not - you can create your own column inherited from HierachyColumn and override OnGetNodeImageIndex and(if necessary) OnGetNodeImageList method to display alternative images.
Link Posted: 24-Dec-2005 22:08
i think you didnt understand my problem.

i have two hierarchical columns, with two differnt imagelist sets.

i want to add a node, if a create a simple treeviewnode and give it image index and then add it to the items of the rows, all is good.

but i want to add two duffernt treeviewnodes, on the same node.

if i try to do so with an array it does not work
Link Posted: 25-Dec-2005 10:37
Can you send us (develop[at]9rays.net) your code to solve this problem?
Link Posted: 23-Jun-2007 01:13
[quote="NineRays"]May be it will better if you will use ImageColumn to display additional images?
If not - you can create your own column inherited from HierachyColumn and override OnGetNodeImageIndex and(if necessary) OnGetNodeImageList method to display alternative images.


Do you have an example of this?  I want a HierachyColumn that will display an image instead of text, from a single ImageList object.
Link Posted: 25-Jun-2007 20:41
If you need to display images only with the HierarchyColumn it is enough to don't provide cell values for this column:
[c#]
//create columns
HierachyColumn firstCol = new HierachyColumn(\"First\");
firstCol.ReadOnly = true;
firstCol.Images = imageList1;
Column secondCol = new Column(\"Second\");
//add columns
flyGrid.Columns.Items.AddRange(firstCol, SecondCol);
//add nodes, fill cell values
for(int i=0; i < 10; i++)
{
  TreeViewNode node = new TreeViewNode();
  node.SelectedImageIndex = 0;
  node.ImageIndex = node.SelectedImageIndex;
  //the cell value corresponded to HierarchyColumn is mepty string
  object[] cellValues = new object[] {string.Empty, \"Row\" + i.ToString()};
  node.Value = cellValues;
  flyGrid.Rows.Items.Add(node);
}
Link Posted: 04-Jul-2007 23:34
I tested this today and it doesnt work (no image appears in hierarchy column). Your code doesnt compile for few reasons so I did it my way. Please tell me what wrong with it. (grid 1.5.2.0)

hierachyColumn1.ImageList = imageList1;
TreeViewNode node1 = new TreeViewNode(new object[] { \"\", \"Parent\" });
TreeViewNode node2 = new TreeViewNode(new object[] { \"\", \"Child1\", \"Child1\" });
TreeViewNode node3 = new TreeViewNode(new object[] { \"\", \"Child2\", \"Child2\" });
TreeViewNode node4 = new TreeViewNode(new object[] { \"\", \"Child3\", \"Child3\" });

node1.Items.Add(node2);
node1.Items.Add(node3);
node1.Items.Add(node4);

this.flyGrid1.Rows.Items.Add(node1);

node1.SelectedImageIndex = 0;
node1.ImageIndex = 0;