示例#1
0
 private void BuildContainerTree(Control ParentControl, TreeNode ParentNode)
 {
     foreach (Control ChildControl in ParentControl.Controls)
     {
         if (ChildControl is Panel || ChildControl is DataGridView || ChildControl is DataGrid ||
             ChildControl is TabPage || ChildControl is InfoNavigator || ChildControl is TabControl ||
             ChildControl is SplitContainer)
         {
             TreeNode ChildNode = new TreeNode();
             ChildNode.Text = ChildControl.Name;
             ParentNode.Nodes.Add(ChildNode);
             TNodeObject NodeObject = new TNodeObject(ChildNode, FClientData, ChildControl);
             if (!(ChildControl is InfoNavigator))
                 BuildContainerTree(ChildControl, ChildNode);
             if (ChildControl is DataGrid)
             {
                 if ((InfoBindingSource)((DataGrid)ChildControl).DataSource != null)
                 {
                     InfoBindingSource aBindingSource = FClientData.FindBindingSource(((InfoBindingSource)((DataGrid)ChildControl).DataSource).Site.Name);
                     NodeObject.BlockItem.BindingSource = aBindingSource;
                 }
             }
             if (ChildControl is DataGridView)
             {
                 if ((InfoBindingSource)((DataGridView)ChildControl).DataSource != null)
                 {
                     InfoBindingSource aBindingSource = FClientData.FindBindingSource(((InfoBindingSource)((DataGridView)ChildControl).DataSource).Site.Name);
                     NodeObject.BlockItem.BindingSource = aBindingSource;
                 }
             }
             if (ChildControl is InfoNavigator)
             {
                 NodeObject.BlockItem.Name = ((InfoNavigator)ChildControl).Name;
                 if ((InfoBindingSource)((InfoNavigator)ChildControl).BindingSource != null)
                 {
                     InfoBindingSource aBindingSource = FClientData.FindBindingSource(((InfoBindingSource)((InfoNavigator)ChildControl).BindingSource).Site.Name);
                     NodeObject.BlockItem.BindingSource = aBindingSource;
                 }
                 if ((InfoBindingSource)((InfoNavigator)ChildControl).ViewBindingSource != null)
                 {
                     InfoBindingSource aBindingSource = FClientData.FindBindingSource(((InfoBindingSource)((InfoNavigator)ChildControl).ViewBindingSource).Site.Name);
                     NodeObject.BlockItem.ViewBindingSource = aBindingSource;
                 }
             }
         }
     }
 }
示例#2
0
 private void InitTemplateFormContainer()
 {
     TreeNode FormNode = tvContainer.Nodes.Add(tbFormName.Text);
     TNodeObject NodeObject = new TNodeObject(FormNode, FClientData, FTemplateForm);
     NodeObject.BlockItem.ContainerName = tbFormName.Text;
     BuildContainerTree(FTemplateForm, FormNode);
     FormNode.ExpandAll();
 }