« Reply #9 on: January 15, 2012, 10:27:53 AM »
Thanks. I tried a lot of different methods and have settled on trying to implement by creating controls on construction and using static visibility control. Problem is I think this will not be the best method for me for others parts of the tree (grid of 300 by 300) where I was using dynamic.
It seems wasteful to create all these controls but I cannot get dynamic control to work and cannot get static declaring and re-use of the same controls to work. I just always end up with inexplicable results on screen.
I wish there were more examples. Yes, you document each function and have the sample suite but, really, multiple small example projects would help hugely.
public int SelectedIndex = -1;
private string s_Description = "description";
private string s_Text = "node";
private Bitmap bmp_TreeImage;
private Bitmap bmp_StatusImage;
private Bitmap bmp_DescriptionImage;
public NodeImage TreeImage = new NodeImage();
public NodeTextBox TreeText = new NodeTextBox();
public NodeImage StatusImage = new NodeImage();
public NodeComboBox BaudRate = new NodeComboBox();
public NodeImage DescriptionImage = new NodeImage();
public NodeTextBox Description = new NodeTextBox();
public BaudRateNode(Node pParentNode)
{
Text = "Baud Rate";
AttachTo(pParentNode);
TreeImage.AttachTo(pParentNode.Treeview);
TreeImage.ColumnId = 0;
TreeImage.DataFieldName = "bmp_TreeImage";
bmp_TreeImage = (this.Treeview as TreeViewWithImages).Bitmaps["folder_open"];
TreeText.AttachTo(pParentNode.Treeview);
TreeText.ColumnId = 0;
TreeText.FillFreeSpace = true;
StatusImage.AttachTo(pParentNode.Treeview);
StatusImage.ColumnId = 3;
StatusImage.ContentAlign = ContentAlignment.MiddleCenter;
StatusImage.FillFreeSpace = true;
StatusImage.DataFieldName = "bmp_StatusImage";
bmp_StatusImage = (this.Treeview as TreeViewWithImages).Bitmaps["image_2"];
BaudRate.AttachTo(pParentNode.Treeview);
BaudRate.ColumnId = 4;
BaudRate.EditStartMode = eEditStartMode.ClickOnSelected;
BaudRate.Editable = true;
BaudRate.FillFreeSpace = true;
BaudRate.DropDownItems = new string[] { "19200", "38400", "57600" };
DescriptionImage.AttachTo(pParentNode.Treeview);
DescriptionImage.ColumnId = 5;
DescriptionImage.ContentAlign = ContentAlignment.MiddleCenter;
DescriptionImage.FillFreeSpace = true;
DescriptionImage.DataFieldName = "bmp_DescriptionImage";
bmp_DescriptionImage = (this.Treeview as TreeViewWithImages).Bitmaps["image_3"];
Description.AttachTo(pParentNode.Treeview);
Description.DataFieldName = "s_Description";
Description.ColumnId = 6;
Description.FillFreeSpace = true;
this.Treeview.NodeControlFilter[this, TreeImage] = eNodeControlVisibility.VisibleForThisNodeOnly;
this.Treeview.NodeControlFilter[this, TreeText] = eNodeControlVisibility.VisibleForThisNodeOnly;
this.Treeview.NodeControlFilter[this, StatusImage] = eNodeControlVisibility.VisibleForThisNodeOnly;
this.Treeview.NodeControlFilter[this, BaudRate] = eNodeControlVisibility.VisibleForThisNodeOnly;
this.Treeview.NodeControlFilter[this, DescriptionImage] = eNodeControlVisibility.VisibleForThisNodeOnly;
this.Treeview.NodeControlFilter[this, Description] = eNodeControlVisibility.VisibleForThisNodeOnly;
}