public override void LoadNextLevel(TreeNodeObject parentNode) { TreeNodeForm tf = (TreeNodeForm)parentNode; for (int i = 0; i < tf._form.Controls.Count; i++) { TreeNodeControl tc = new TreeNodeControl(tf._form.Controls[i]); parentNode.Nodes.Add(tc); } if (tf._form.Site != null && tf._form.Site.DesignMode) { for (int i = 0; i < tf._form.Site.Container.Components.Count; i++) { if (!(tf._form.Site.Container.Components[i] is Control) && tf._form.Site.Container.Components[i].Site != null) { TreeNodeComponent tn = new TreeNodeComponent(tf._form.Site.Container.Components[i], tf._form.Site.Container.Components[i].Site.Name); parentNode.Nodes.Add(tn); } } } else { FieldInfo[] fifs = tf._form.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic); if (fifs != null && fifs.Length > 0) { for (int i = 0; i < fifs.Length; i++) { if (!fifs[i].IsStatic && !fifs[i].FieldType.IsSubclassOf(typeof(Control))) { TypeFilter tfl = new TypeFilter(onFindInterface); Type[] tps = fifs[i].FieldType.FindInterfaces(tfl, null); if (tps != null && tps.Length > 0) { TreeNodeComponent tn = new TreeNodeComponent((IComponent)fifs[i].GetValue(tf._form), fifs[i].Name); parentNode.Nodes.Add(tn); } } } } } // TreeNodeObject.LoadNextLevel(parentNode, typeof(Form)); // }
public void LoadData(Form form) { TreeNodeForm tf = new TreeNodeForm(form); Nodes.Add(tf); }