Inheritance: System.MarshalByRefObject, ICloneable, ISerializable
コード例 #1
1
ファイル: TableViewForm.cs プロジェクト: hong1975/wats
        public TableViewForm(TreeNode analysisViewNode)
        {
            InitializeComponent();

            mAnalysisViewNode = analysisViewNode;
            mTask = ((TaskModel)analysisViewNode.Parent.Parent.Tag).mTask;
        }
コード例 #2
1
ファイル: PowerTreeView.cs プロジェクト: wuyanqing/wc001
        //private int len = 2;
        public void RootNode(TreeNode pNode)
        {
            if (ds == null)
                return;
            DataView dvTree = new DataView(ds.Tables[0]);
            //dvTree.RowFilter = "len(Code)=" + len.ToString();
            dvTree.RowFilter = "Parent_Code=0";//Rank=1";
            foreach (DataRowView Row in dvTree)
            {
                TreeNode Node = this.Nodes.Add(Row["Code"].ToString(), "[" + Row["Code"].ToString() + "]" + Row["Name"].ToString(), 1);
                //AddNode(Node, len);
                AddNode(Node);
            }
            this.ExpandAll();
            if (m_SelectName.Trim() == "")
                return;
            foreach (TreeNode nt in this.Nodes)
            {
                if (nt.Name == SelectStringByLen(2))
                {
                    this.SelectedNode = nt;
                    if (m_SelectName.Length > 2)
                        Select(nt);
                    return;
                }

            }
        }
コード例 #3
1
ファイル: MULT.cs プロジェクト: pho/WindViewer
        public MULT(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color))
        {
            ParentFile = FE;

            byte[] SrcData = ParentFile.GetFileData();

            Offset = SrcOffset;

            _Translation = new Vector2(
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04)));
            _Rotation = ((short)(Helpers.Read16(SrcData, SrcOffset + 0x08)) / 182.04444444444444f).Clamp(-180, 179);
            _RoomNumber = SrcData[SrcOffset + 0x0A];
            _Unknown2 = SrcData[SrcOffset + 0x0B];

            SrcOffset += 0x0C;

            RenderColor = Color;

            Node = Helpers.CreateTreeNode(string.Format("{0:X6}: {1}", Offset, new Vector2(_Translation.X / 100000, _Translation.Y / 100000)), this, string.Format("{0}", _Translation));
            ParentNode.BackColor = RenderColor;
            ParentNode.Nodes.Add(Node);

            GLID = GL.GenLists(1);
            GL.NewList(GLID, ListMode.Compile);
            Helpers.DrawFramedCube(new Vector3d(15, 15, 15));
            GL.EndList();
        }
コード例 #4
1
ファイル: TagDetailForm.cs プロジェクト: JTOne123/ukrsecond
        private void BindTags()
        {
            cbTagCategory.DisplayMember = "Name";
            cbTagCategory.ValueMember = "ID";
            cbTagCategory.DataSource = TagCategories;

            tvTags.Nodes.Clear();

            foreach (var tc in TagCategories)
            {
                var catNode = new TreeNode();
                catNode.Text = tc.Name;

                foreach (var t in Tags.Where(w => w.TagCategoryID == tc.ID))
                {
                    var tNode = new TreeNode();
                    tNode.Text = t.Name;
                    tNode.Tag = t;
                    tNode.Checked = SelectedTags.Exists(w => w.ID == t.ID);

                    catNode.Nodes.Add(tNode);
                }

                tvTags.Nodes.Add(catNode);
            }

            tvTags.ExpandAll();
        }
コード例 #5
1
ファイル: clsCommon.cs プロジェクト: hollis21/Chummer
        /// <summary>
        /// Build up the Tree for the current piece of Cyberware and all of its children.
        /// </summary>
        /// <param name="objCyberware">Cyberware to iterate through.</param>
        /// <param name="objParentNode">TreeNode to append to.</param>
        /// <param name="objMenu">ContextMenuStrip that the new Cyberware TreeNodes should use.</param>
        /// <param name="objGearMenu">ContextMenuStrip that the new Gear TreeNodes should use.</param>
        public void BuildCyberwareTree(Cyberware objCyberware, TreeNode objParentNode, ContextMenuStrip objMenu, ContextMenuStrip objGearMenu)
        {
            TreeNode objNode = new TreeNode();
                objNode.Text = objCyberware.DisplayName;
                objNode.Tag = objCyberware.InternalId;
                if (objCyberware.Notes != string.Empty)
                    objNode.ForeColor = Color.SaddleBrown;
                objNode.ToolTipText = objCyberware.Notes;
                objNode.ContextMenuStrip = objMenu;

                objParentNode.Nodes.Add(objNode);
                objParentNode.Expand();

                foreach (Cyberware objChild in objCyberware.Children)
                    BuildCyberwareTree(objChild, objNode, objMenu, objGearMenu);

                foreach (Gear objGear in objCyberware.Gear)
                {
                    TreeNode objGearNode = new TreeNode();
                    objGearNode.Text = objGear.DisplayName;
                    objGearNode.Tag = objGear.InternalId;
                    if (objGear.Notes != string.Empty)
                        objGearNode.ForeColor = Color.SaddleBrown;
                    objGearNode.ToolTipText = objGear.Notes;
                    objGearNode.ContextMenuStrip = objGearMenu;

                    BuildGearTree(objGear, objGearNode, objGearMenu);

                    objNode.Nodes.Add(objGearNode);
                    objNode.Expand();
                }
        }
コード例 #6
1
ファイル: ExceptionDetails.cs プロジェクト: mgnslndh/NCrash
        private void DisplayExceptionDetails(TreeNode node)
        {
            var exception = _exceptionDetailsList[node];
            exceptionDetailsListView.SuspendLayout();
            exceptionDetailsListView.Items.Clear();

            if (exception.Type != null) exceptionDetailsListView.Items.Add("Exception").SubItems.Add(exception.Type);
            if (exception.Message != null) exceptionDetailsListView.Items.Add("Message").SubItems.Add(exception.Message);
            if (exception.TargetSite != null) exceptionDetailsListView.Items.Add("Target Site").SubItems.Add(exception.TargetSite);
            if (exception.InnerException != null) exceptionDetailsListView.Items.Add("Inner Exception").SubItems.Add(exception.InnerException.Type);
            if (exception.Source != null) exceptionDetailsListView.Items.Add("Source").SubItems.Add(exception.Source);
            if (exception.HelpLink != null) exceptionDetailsListView.Items.Add("Help Link").SubItems.Add(exception.HelpLink);
            if (exception.StackTrace != null) exceptionDetailsListView.Items.Add("Stack Trace").SubItems.Add(exception.StackTrace);

            if (exception.Data != null)
            {
                foreach (var pair in exception.Data)
                {
                    exceptionDetailsListView.Items.Add(string.Format("Data[\"{0}\"]", pair.Key)).SubItems.Add(pair.Value.ToString());
                }
            }

            if (exception.ExtendedInformation != null)
            {
                foreach (var info in exception.ExtendedInformation)
                {
                    var item = exceptionDetailsListView.Items.Add(info.Key);
                    item.UseItemStyleForSubItems = false;
                    item.Font = new Font(Font, FontStyle.Bold);
                    item.SubItems.Add(info.Value.ToString());
                }
            }

            exceptionDetailsListView.ResumeLayout();
        }
コード例 #7
1
        public static TreeNode[] GetTree(this Ast ast)
        {
            var index = new Dictionary<Ast, TreeNode>();
            var tree = new List<TreeNode>();

            foreach (var ast1 in ast.FindAll(_ => true, true).ToList())
            {
                var node = new TreeNode(ast1.GetType().ToString().Split('.').Last());
                node.ToolTipText = ast1.Extent.Text;

                index.Add(ast1, node);

                TreeNode parent;
                if (ast1.Parent != null && index.TryGetValue(ast1.Parent, out parent))
                {
                    parent.Nodes.Add(node);
                }
                else
                {
                    tree.Add(node);
                }
            }

            return tree.ToArray();
        }
コード例 #8
1
ファイル: frmSupplier.cs プロジェクト: caocf/workspace-kepler
 private void CreatPropertiesTree()
 {
     DataTable dtproperty = CommonFuncCall.GetDictionariesByDic_codes("sys_enterprise_property");
     TreeNode tmpNd;
     if (dtproperty != null)
     {
         foreach (DataRow drv in dtproperty.Rows)
         {
             tmpNd = new TreeNode();
             tmpNd.Tag = drv;
             tmpNd.Text = drv["dic_name"].ToString(); //name
             //tmpNd.Name = drv["dic_id"].ToString();//id
             tmpNd.Name = string.Empty;//id
             this.tvNature.Nodes.Add(tmpNd);
         }
     }
     ArrayList dic_name = new ArrayList();
     dic_name.Add("sys_enterprise_property");
     dtproperty = CommonFuncCall.GetDictionariesByPDic_codes(dic_name);
     if (dtproperty != null)
     {
         foreach (DataRow drv in dtproperty.Rows)
         {
             tmpNd = new TreeNode();
             tmpNd.Tag = drv;
             tmpNd.Text = drv["dic_name"].ToString(); //name
             tmpNd.Name = drv["dic_id"].ToString();//id
             this.tvNature.Nodes[0].Nodes.Add(tmpNd);
         }
     }
     this.tvNature.Nodes[0].Expand();
 }
コード例 #9
1
ファイル: bookTypeClass.cs プロジェクト: ATLgo/bookMis
        public void initTrvTree(TreeNodeCollection treeNodes, string strParentIndex, DataView dvList)
        {
            try
            {
                TreeNode tempNode;
                DataView dvList1;
                string currentNum;
                dvList1 = dvList;
                // select the datarow that it's parentcode is strParentIndex
                DataRow[] dataRows = dvList.Table.Select("parentCode ='" + strParentIndex + "'");
                foreach (DataRow dr in dataRows)
                {
                    tempNode = new TreeNode();
                    tempNode.Text = dr["bookTypeCode"].ToString() + "-"
                        + dr["bookTypeName"].ToString();
                    // tag property is save data about this treenode
                    tempNode.Tag = new treeNodeData(dr["bookTypeCode"].ToString(),
                        dr["bookTypeName"].ToString(), dr["bookTypeExplain"].ToString(),
                        dr["currentCode"].ToString(), dr["parentCode"].ToString());

                    currentNum = dr["currentCode"].ToString();
                    treeNodes.Add(tempNode);
                    // call rucursive
                    TreeNodeCollection temp_nodes = treeNodes[treeNodes.Count - 1].Nodes;
                    initTrvTree(temp_nodes, currentNum, dvList1);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("初始化TreeView失败");
            }
        }
コード例 #10
1
ファイル: frmPermisos.cs プロジェクト: hvivani/SOffT
        private void agregarNodo(XmlNode inXmlNode, TreeNode inTreeNode)
        {
            XmlNode xNode;
            TreeNode tNode;
            XmlNodeList nodeList;
            int i;

            // Loop through the XML nodes until the leaf is reached.
            // Add the nodes to the TreeView during the looping process.
            if (inXmlNode.HasChildNodes)
            {
                nodeList = inXmlNode.ChildNodes;
                for (i = 0; i <= nodeList.Count - 1; i++)
                {
                    xNode = inXmlNode.ChildNodes[i];
                    inTreeNode.Nodes.Add(xNode.Attributes["Nombre"].Value);
                    tNode = inTreeNode.Nodes[i];
                    agregarNodo(xNode, tNode);
                }
            }
            else
            {
                // Here you need to pull the data from the XmlNode based on the
                // type of node, whether attribute values are required, and so forth.
                inTreeNode.Text = inXmlNode.Attributes["Nombre"].Value;
            }
        }
コード例 #11
1
		public TreeNode AddProjectNode(TreeNode motherNode, IProject project)
		{			
			ProjectNode projectNode = new ProjectNode(project);
			projectNode.AddTo(motherNode);

			ReferenceFolder referenceFolderNode = new ReferenceFolder(project);
			referenceFolderNode.AddTo(projectNode);

			//TagManagerNode tagManagerNode = new TagManagerNode(project);
			//tagManagerNode.AddTo(projectNode);
//			
//			TagListFileNode tagListFileNode = new TagListFileNode(TagManager.FullFileName, FileNodeStatus.InProject);
//			tagListFileNode.AddTo(projectNode);
				
//			TagGroupNode tagGroupNode = new TagGroupNode(project);
//			tagGroupNode.AddTo(projectNode);

//			AimTagGroupFolderNode aimTagGroupFolderNode = new AimTagGroupFolderNode(project);
//			aimTagGroupFolderNode.AddTo(projectNode);
//
//			SecurityNode securityNode = new SecurityNode(project);
//			securityNode.AddTo(projectNode);

			//DriverFolderNode driverFolderNode = new DriverFolderNode(project);
			//driverFolderNode.AddTo(projectNode);

			motherNode.TreeView.MouseDoubleClick += new MouseEventHandler(TreeView_MouseDoubleClick);

			return projectNode;
		}
コード例 #12
1
        private void treeViewGroup_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                //Start of: Change Font of  selected node
                if (prevNode != null)
                {
                    prevNode.ForeColor = Color.Black;
                    prevNode.NodeFont = new Font(Font.FontFamily, Font.Size, FontStyle.Regular);
                }

                prevNode = treeViewGroup.SelectedNode;

                treeViewGroup.SelectedNode.ForeColor = Color.Blue;
                treeViewGroup.SelectedNode.NodeFont = new Font(Font.FontFamily.Name, Font.Size, FontStyle.Regular);
                //End of: Change Font of  selected node

                PrincipalContext ctx = new PrincipalContext(ContextType.Domain, treeViewGroup.SelectedNode.ImageKey); 
                
                GroupPrincipal grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, treeViewGroup.SelectedNode.Text);


                userDetails = (from u in grp.Members
                               select new UserDetails { DisplayName = u.DisplayName, UserName = u.SamAccountName,Domain = u.Context.Name }).OrderBy(x => x.DisplayName).ToList();
             
                userControlListing.DataSource = userDetails;
                
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #13
1
ファイル: MongoView.cs プロジェクト: yksoft/MyMongoDB
        /// <summary>
        /// 初始化(获取mongodb信息)
        /// </summary>
        public void Init()
        {
            this.treeView1.Nodes.Clear();
            connectionString = this.textBox_MongoUrl.Text;
            service = new MongoService(new MongoConnectionString(connectionString));
            //所有数据库
            var listDatabase = service.client.ListDatabases().ToList();
            foreach(BsonDocument dbDoc in listDatabase)
            {
                var dbName = dbDoc["name"].ToString();
                TreeNode dbNode = new TreeNode(dbName, 0, 0);
                dbNode.Tag = "database";

                var db = service.client.GetDatabase(dbName);
                //所有集合(可以理解为表)
                var listCollection = db.ListCollections().ToList();
                foreach (BsonDocument collDoc in listCollection)
                {
                    var collName = collDoc["name"].ToString();
                    TreeNode collNode = new TreeNode(collName,1,1);
                    collNode.Tag = "collection";
                    dbNode.Nodes.Add(collNode);
                }
                this.treeView1.Nodes.Add(dbNode);
            }
        }
コード例 #14
1
 private TreeNode RecurrsiveSearch(int id)
 {
     Hash source = Project.Data.MapInfos;
     var mapInfo = source[id] as MapInfo;
     if (mapInfo != null)
     {
         var node = new TreeNode
         {
             Name = id.ToString(),
             ImageIndex = 1,
             SelectedImageIndex = 1,
             Text = mapInfo.name,
             Tag = mapInfo
         };
         foreach (MapInfo info in source.Values)
         {
             int childId = source.GetKey(info);
             if (info.parent_id == id && !_skipIds.Contains(childId))
             {
                 _skipIds.Add(childId);
                 node.Nodes.Add(RecurrsiveSearch(childId));
             }
         }
         return node;
     }
     return null;
 }
コード例 #15
1
ファイル: testPowerpoint_old.cs プロジェクト: kaiss78/hustoes
 private void testPointView_AfterSelect(object sender, TreeViewEventArgs e)
 {
     TreeNode tmpNode;
     ItemObject tmpObj;
     List<ItemObject> stack;
     if (e.Node == Root) return;                     //根节点返回
     ItemObject itm = e.Node.Tag as ItemObject;
     listProperty(itm);
     #region 显示当前的item
     stack = new List<ItemObject>(10);
     tmpNode = e.Node;
     stack.Add(tmpNode.Tag as ItemObject);
     while ((tmpNode.Tag as ItemObject).type != PptType.Slide)
     {
         tmpNode = tmpNode.Parent;
         stack.Add(tmpNode.Tag as ItemObject);
     }
     while (stack.Count > 0)
     {
         try
         {
             tmpObj = stack[stack.Count - 1];
             showSomething(tmpObj);
             stack.RemoveAt(stack.Count - 1);
         }
         catch
         {
             throw;
         }
     }
     #endregion
 }
コード例 #16
0
ファイル: ConfigMessages.cs プロジェクト: wlcaption/eibsuite
        public void LoadCategoryRecords(TreeNode CategoryNode)
        {
            if (CategoryNode.Tag == null) return;

            DataRow category_row = (DataRow)CategoryNode.Tag;
            DataRow[] child_rows = category_row.GetChildRows(_ds.Relations[1]);

            foreach (DataRow row in child_rows)
            {
                //only one telegram per record
                DataRow data = row.GetChildRows(_ds.Relations[0])[0];

                ListViewItem item = new ListViewItem();
                item.Tag = row;

                item.ImageIndex = 2;
                //phrase
                item.Text = row["Phrase"].ToString();;

                //item.SubItems.Add("0x" + ((byte)data["MessageControl"]).ToString("X"));
                //item.SubItems.Add(data["SourceAddress"].ToString());
                item.SubItems.Add(data["DestinationAddress"].ToString());
                item.SubItems.Add("0x" + ((byte)data["TCPI"]).ToString("X"));
                item.SubItems.Add("0x" + ((byte)data["APCI"]).ToString("X"));

                this.lvRecords.Items.Add(item);
            }
        }
コード例 #17
0
ファイル: Versioning.cs プロジェクト: naztrain/vixen
        private void AddTreeNode(ChangeDetails detail)
        {
            try
            {

                var details = detail.FileName.Split('/');
                TreeNode node;
                foreach (var item in details)
                {

                    if (treeViewFiles.Nodes.ContainsKey(item))
                    {
                        node = treeViewFiles.Nodes.Find(item, false).First();
                    }
                    else
                    {
                        node = new TreeNode(item);
                        node.Tag = detail;
                        treeViewFiles.Nodes.Add(node);
                    }
                }

                node = new TreeNode(detail.ChangeDate.ToString());
                node.Tag = detail;
                node.Nodes.Add(node);

            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
コード例 #18
0
        private static TreeNode CreateTreeNode(DirectoryEntry directoryEntry)
        {
            InitAllowedSchemaClass();
            if (allowedSchemaClass.Contains(directoryEntry.SchemaClassName))
            {
                TreeNode node = new TreeNode();
                if (directoryEntry.SchemaClassName.Equals(IISConstants.TYPE_WEBSERVER, StringComparison.InvariantCulture))
                {
                    node.Text = IISConstants.GetProperty<string>(directoryEntry, IISConstants.PROPERTY_WEBSITE_NAME);
                }
                else
                {
                    node.Text = directoryEntry.Name;
                }
                node.ImageKey = directoryEntry.SchemaClassName;
                node.SelectedImageKey = directoryEntry.SchemaClassName;
                node.Tag = directoryEntry.Path;

                foreach (DirectoryEntry child in directoryEntry.Children)
                {
                    TreeNode childNode = CreateTreeNode(child);
                    if (childNode != null) node.Nodes.Add(childNode);
                }
                return node;
            }
            else
            {
                return null;
            }
        }
コード例 #19
0
 public TreeNode checkIfNodeHasType(TreeNode nodeToSearch, string nodeName, string expectedNodeType,
                                    ascx_O2Reflector.AvailableEngines engineToTest)
 {
     TreeNode node = nodeToSearch.Nodes[nodeName];
     testEngineNode(node, expectedNodeType, nodeName, engineToTest, false);
     return node;
 }
コード例 #20
0
        /// <summary>
        /// Loads the root TreeView nodes.
        /// </summary>
        private void LoadRootNodes()
        {
            // Create the root shell item.
            ShellItem m_shDesktop = new ShellItem();

            // Create the root node.
            TreeNode tvwRoot = new TreeNode();
            tvwRoot.Text = m_shDesktop.DisplayName;
            tvwRoot.ImageIndex = m_shDesktop.IconIndex;
            tvwRoot.SelectedImageIndex = m_shDesktop.IconIndex;
            tvwRoot.Tag = m_shDesktop;

            // Now we need to add any children to the root node.
            ArrayList arrChildren = m_shDesktop.GetSubFolders();
            foreach (ShellItem shChild in arrChildren)
            {
                TreeNode tvwChild = new TreeNode();
                tvwChild.Text = shChild.DisplayName;
                tvwChild.ImageIndex = shChild.IconIndex;
                tvwChild.SelectedImageIndex = shChild.IconIndex;
                tvwChild.Tag = shChild;

                // If this is a folder item and has children then add a place holder node.
                if (shChild.IsFolder && shChild.HasSubFolder)
                    tvwChild.Nodes.Add("PH");
                tvwRoot.Nodes.Add(tvwChild);
            }

            // Add the root node to the tree.
            treeWnd.Nodes.Clear();
            treeWnd.Nodes.Add(tvwRoot);
            tvwRoot.Expand();
        }
コード例 #21
0
ファイル: UIHelper.cs プロジェクト: magicdict/MongoCola
 /// <summary>
 ///     将BsonArray放入树形控件
 /// </summary>
 /// <param name="arrayName"></param>
 /// <param name="newItem"></param>
 /// <param name="item"></param>
 public static void AddBsonArrayToTreeNode(string arrayName, TreeNode newItem, BsonArray item)
 {
     var count = 1;
     foreach (var subItem in item)
     {
         if (subItem.IsBsonDocument)
         {
             var newSubItem = new TreeNode(arrayName + "[" + count + "]");
             AddBsonDocToTreeNode(newSubItem, subItem.ToBsonDocument());
             newSubItem.Tag = subItem;
             newItem.Nodes.Add(newSubItem);
         }
         else
         {
             if (subItem.IsBsonArray)
             {
                 var newSubItem = new TreeNode(ConstMgr.ArrayMark);
                 AddBsonArrayToTreeNode(arrayName, newSubItem, subItem.AsBsonArray);
                 newSubItem.Tag = subItem;
                 newItem.Nodes.Add(newSubItem);
             }
             else
             {
                 var newSubItem = new TreeNode(arrayName + "[" + count + "]") { Tag = subItem };
                 newItem.Nodes.Add(newSubItem);
             }
         }
         count++;
     }
 }
コード例 #22
0
 public TransitionWizard()
 {
     TransitionWizard twiz = this;
     base.Load += new EventHandler(twiz.Twiz_Load);
     this.ViewTiles = false;
     this.iMapNode = new TreeNode("Map Tiles");
     this.iStaticNode = new TreeNode("Static Tiles");
     this.iMapOuterTopLeft = new TreeNode("Outer Top Left");
     this.iMapOuterTopRight = new TreeNode("Outer Top Right");
     this.iMapOuterBottomLeft = new TreeNode("Outer Bottom Left");
     this.iMapOuterBottomRight = new TreeNode("Outer Bottom Right");
     this.iMapInnerTopLeft = new TreeNode("Inner Top Left");
     this.iMapInnerTop = new TreeNode("Inner Top");
     this.iMapInnerTopRight = new TreeNode("Inner Top Right");
     this.iMapInnerLeft = new TreeNode("Inner Left");
     this.iMapInnerRight = new TreeNode("Inner Right");
     this.iMapInnerBottomLeft = new TreeNode("Inner Bottom Left");
     this.iMapInnerBottom = new TreeNode("Inner Bottom");
     this.iMapInnerBottomRight = new TreeNode("Inner Bottom Right");
     this.iStaticOuterTopLeft = new TreeNode("Outer Top Left");
     this.iStaticOuterTopRight = new TreeNode("Outer Top Right");
     this.iStaticOuterBottomLeft = new TreeNode("Outer Bottom Left");
     this.iStaticOuterBottomRight = new TreeNode("Outer Bottom Right");
     this.iStaticInnerTopLeft = new TreeNode("Inner Top Left");
     this.iStaticInnerTop = new TreeNode("Inner Top");
     this.iStaticInnerTopRight = new TreeNode("Inner Top Right");
     this.iStaticInnerLeft = new TreeNode("Inner Left");
     this.iStaticInnerRight = new TreeNode("Inner Right");
     this.iStaticInnerBottomLeft = new TreeNode("Inner Bottom Left");
     this.iStaticInnerBottom = new TreeNode("Inner Bottom");
     this.iStaticInnerBottomRight = new TreeNode("Inner Bottom Right");
     this.iGroupA = new ClsTerrainTable();
     this.iGroupB = new ClsTerrainTable();
     InitializeComponent();
 }
コード例 #23
0
 /// <summary>
 /// Busca dado el nodo raíz, el camino hasta el final de full_path.
 /// </summary>
 /// <param name="root"></param>
 /// <param name="full_path">Camino separado por \\, el primer valor coincide con el nombre del Album.</param>
 /// <returns></returns>
 public static string ShowNode(TreeNode root, string full_path)
 {
     string[] separeted_path = full_path.Split(new string[]{"\\"}, StringSplitOptions.RemoveEmptyEntries);
     TreeNode tmp_node = root ;
     tmp_node.Expand();
     //k es igual a 1 pues separeted_path en 0 tiene el nombre del album.
     string tmp;
     for(int k = 1; k < separeted_path.Length; k++){
         if (separeted_path[k] == "")
             continue;
         foreach (TreeNode node in tmp_node.Nodes) {
             tmp = node.Text.Replace("\\", "");
             if (tmp == separeted_path[k])
             {
                 node.Expand();
                 tmp_node = node;
                 break;
             }
         }
     }
     tmp_node.TreeView.SelectedNode = tmp_node;
     string last_file = separeted_path[separeted_path.Length - 1];
     if (tmp_node.Text == last_file)     //es una carpeta
         return "";
     else                                //es un archivo
         return last_file;
 }
コード例 #24
0
ファイル: Form1.cs プロジェクト: adesproject/ADES
        private void AddNode(XmlNode inXmlNode, TreeNode inTreeNode)
        {
            XmlNode xNode;
            TreeNode tNode;
            XmlNodeList nodeList;
            int i;

            // Loop through the XML nodes until the leaf is reached.
            // Add the nodes to the TreeView during the looping process.
            if (inXmlNode.HasChildNodes && inXmlNode.FirstChild.HasChildNodes)
            {
                nodeList = inXmlNode.ChildNodes;
                for (i = 0; i <= nodeList.Count - 1; i++)
                {
                    xNode = inXmlNode.ChildNodes[i];
                    inTreeNode.Nodes.Add(xNode.Name, xNode.Name);
                    tNode = inTreeNode.Nodes[i];
                    AddNode(xNode, tNode);
                }
            }
            else
            {
                // Here you need to pull the data from the XmlNode based on the
                // type of node, whether attribute values are required, and so forth.
                String str = (inXmlNode.InnerText).Trim();
                TreeNode parent = inTreeNode.Parent;
                inTreeNode.Remove();
                parent.Nodes.Add(str, str);
                //inTreeNode.Text = (inXmlNode.InnerText).Trim();
            }
        }
コード例 #25
0
 public FormQueryName(int userId, TreeView treeView, TreeNode folderNode)
 {
     InitializeComponent();
     _connectionID = userId;
     _original = treeView;
     CurrentFolderNode = folderNode;
 }
コード例 #26
0
        public ImportChannelsContext(ChannelType channelType)
        {
            _channelType = channelType;

            List<TreeNode> nodes = new List<TreeNode>();

            if (channelType == ChannelType.Television)
            {
                List<TvDatabase.ChannelGroup> groups = Utility.GetAllGroups<TvDatabase.ChannelGroup>();
                groups.Add(new TvDatabase.ChannelGroup(-1, "All Channels"));
                foreach (TvDatabase.ChannelGroup group in groups)
                {
                    TreeNode groupNode = new TreeNode(group.GroupName);
                    groupNode.Tag = group;
                    nodes.Add(groupNode);
                    groupNode.Nodes.Add(String.Empty);
                }
            }
            else
            {
                List<TvDatabase.RadioChannelGroup> groups = Utility.GetAllGroups<TvDatabase.RadioChannelGroup>();
                groups.Add(new TvDatabase.RadioChannelGroup(-1, "All Channels"));
                foreach (TvDatabase.RadioChannelGroup group in groups)
                {
                    TreeNode groupNode = new TreeNode(group.GroupName);
                    groupNode.Tag = group;
                    nodes.Add(groupNode);
                    groupNode.Nodes.Add(String.Empty);
                }
            }

            _channelNodes = nodes.ToArray();
        }
コード例 #27
0
        private async Task<TreeNode[]> GetNodes(string path)
        {

            Metadata[] entries = (await MainForm.Client.Files.ListFolder(path)).Entries;

            List<TreeNode> nodes = new List<TreeNode>();

            foreach (Metadata entry in entries)
            {
                
                if (entry.IsFolder)
                {

                    TreeNode node = new TreeNode();

                    node.Name = entry.Name;
                    node.Text = entry.Name;
                    node.Tag = entry;
                    node.Nodes.Add("");

                    nodes.Add(node);

                }

            }

            return nodes.ToArray();

        }
コード例 #28
0
ファイル: ThingEditor.cs プロジェクト: romanu6891/fivemen
        private void CreateDefaultNode()
        {
            this.treeView1.ImageList = this.imageList1;
            TreeNode top = new TreeNode("�ҵļ��±�");
            top.Tag = "-1";
            top.ImageIndex = 0;
            top.SelectedImageIndex = 0;
            top.Nodes.Add(this.CreateSecondNode("�ƻ���",-2));
            top.Nodes.Add(this.CreateSecondNode("��������",-3));
            top.Nodes.Add(this.CreateSecondNode("����",-4));

            this.treeView1.HideSelection = false;
            this.treeView1.LabelEdit = true;
            this.treeView1.ShowNodeToolTips = true;

            this.treeView1.AfterSelect += new TreeViewEventHandler(treeView1_AfterSelect);
            this.treeView1.DoubleClick += new EventHandler(treeView1_DoubleClick);
            this.treeView1.KeyDown += new KeyEventHandler(treeView1_KeyDown);
            this.treeView1.AfterLabelEdit += new NodeLabelEditEventHandler(treeView1_AfterLabelEdit);
            this.treeView1.MouseClick += new MouseEventHandler(treeView1_MouseClick);
            string sql = "select id,c_title,d_notedate,c_context,i_parent_id,i_node_type from table_things where i_parent_id in ('-2','-3','-4') order by id asc";
            DataTable dt = FT.DAL.DataAccessFactory.GetDataAccess().SelectDataTable(sql, "tmp");
            if(dt!=null)
            {
                for (int i = 0; i < dt.Rows.Count;i++ )
                {
                    CreateNodeFromDr(top,dt.Rows[i]);
                }
            }
            top.ExpandAll();
            this.treeView1.Nodes.Add(top);
        }
コード例 #29
0
        public void ReLoadTree()
        {
            CHECKTree.Nodes.Clear();

            root = new TreeNode();
            root.Text = AppConf.Ins.Application.AppName;
            root.Tag = AppConf.Ins.Application;
            CHECKTree.Nodes.Add(root);


            TreeNode moduleNode, entityNode;
            foreach (ModuleInfo module in AppConf.Ins.Application.Modules)
            {
                moduleNode = new TreeNode(module.ModuleName + "[" + module.Caption + "," + module.Prefix + "]");
                moduleNode.Tag = module;
                root.Nodes.Add(moduleNode);

                foreach (EntityInfo entity in module.Entitys)
                {
                    entityNode = new TreeNode(entity.EntityName + "[" + entity.ClassName + ",ops:" + entity.operaters.Count + "]");
                    entityNode.Tag = entity;

                    moduleNode.Nodes.Add(entityNode);
                }
                CheckedModule = module;
            }
            CHECKTree.NodeMouseClick += CHECKTree_NodeMouseClick;
            CHECKTree.AfterCheck += CHECKTree_AfterCheck;
            CHECKTree.NodeMouseDoubleClick += CHECKTree_NodeMouseDoubleClick;
            CHECKTree.CheckBoxes = true;
            CHECKTree.ExpandAll();
        }
コード例 #30
0
        private void dataAnlysis_Load(object sender, EventArgs e)
        {

            treeView1.Nodes.Clear();
            //提取数据库中各表的字段
            DataTable dt =streamMessagePool . Acc.Tables;
            TreeNode txtRoot = new TreeNode("Dump_Detail_Table");
            treeView1.Nodes.Add(txtRoot);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
               string tb = dt.Rows[i]["TABLE_NAME"].ToString();
                TreeNode rootMessage = new TreeNode(tb);
                txtRoot.Nodes.Add(rootMessage);
            }
            //提取消息字段和数量
           dt = streamMessagePool.Acc.RunQuery("select message_info,count(*) c from softerCell_have_read"+
                " group by message_info order by 2 desc ");
            TreeNode infoRoot = new TreeNode("Info_Field_Table");
            treeView1.Nodes.Add(infoRoot);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string tb = dt.Rows[i][0].ToString() + "," + dt.Rows[i][1].ToString();
                TreeNode rootMessage = new TreeNode(tb);
                infoRoot.Nodes.Add(rootMessage);
            }

            TreeNode dataRoot = new TreeNode("Data_Table_Field");
            treeView1.Nodes.Add(dataRoot);

            treeView1.ExpandAll();

            treeView1.SelectedNode = txtRoot;
        }
コード例 #31
0
 private void OnUnindentButtonClick()
 {
     System.Windows.Forms.TreeNode selectedNode = this._treeView.SelectedNode;
     if (selectedNode != null)
     {
         System.Windows.Forms.TreeNode parent = selectedNode.Parent;
         if (parent != null)
         {
             System.Windows.Forms.TreeNodeCollection nodes = this._treeView.Nodes;
             if (parent.Parent != null)
             {
                 nodes = parent.Parent.Nodes;
             }
             if (parent != null)
             {
                 selectedNode.Remove();
                 nodes.Insert(parent.Index + 1, selectedNode);
                 this._treeView.SelectedNode = selectedNode;
             }
         }
     }
 }
コード例 #32
0
        public void TreeViewMenu_AfterSelect_SetsButtonsEnabledStatus_WhenParentOfSelectedNodeIsNotNullAndNodesCountIsOne()
        {
            // Arrange
            var parentNode = new WinForms.TreeNode();
            var node01     = new WinForms.TreeNode();

            parentNode.Nodes.Add(node01);

            _treeViewMenu.Nodes.Add(parentNode);
            _treeViewMenu.SelectedNode     = node01;
            _treeViewMenu.SelectedNode.Tag = _nodeDesign;

            // Act
            _propertyBuilderPrivateObject.Invoke("_tvTree_AfterSelect", null, new WinForms.TreeViewEventArgs(null));

            // Assert
            _btnMoveUp.Enabled.ShouldBeFalse();
            _btnMoveDown.Enabled.ShouldBeFalse();
            _btnChildSibling.Enabled.ShouldBeFalse();
            _btnSiblingParent.Enabled.ShouldBeTrue();
            _propertyGridTreeView.SelectedObject.ShouldBeSameAs(_nodeDesign);
        }
コード例 #33
0
        private void displayChildNodes(System.Windows.Forms.TreeNode parentNode)
        {
            DirectoryInfo FS = new DirectoryInfo(stripExtraSlash(parentNode.FullPath));

            //DirectoryInfo dirInfo = new DirectoryInfo(parentNode.FullPath);
            //FileInfo fileInfo = default(FileInfo);
            try {
                // ---displays all dirs---
                foreach (DirectoryInfo dirInfo in FS.GetDirectories())           //foreach ( dirInfo in FS.GetDirectories()) {
                // ---create a new node to be added---
                {
                    TreeNode node = new TreeNode();
                    node.Text = dirInfo.Name;
                    // name of file or dir
                    node.ImageIndex         = icoClose;
                    node.SelectedImageIndex = icoOpen;
                    parentNode.Nodes.Add(node);
                    // ---add the dummy node---
                    node.Nodes.Add("");
                }
            } catch (Exception err) {
                MessageBox.Show(err.ToString());
            }
            try {
                // --display all files---
                foreach (FileInfo fileInfo in FS.GetFiles())
                {
                    // ---create a new node to be added---
                    TreeNode node = new TreeNode();
                    node.Text               = fileInfo.Name;
                    node.ImageIndex         = icoFile;
                    node.SelectedImageIndex = icoFile;
                    parentNode.Nodes.Add(node);
                }
            } catch (Exception err) {
                MessageBox.Show(err.ToString());
            }
        }
コード例 #34
0
        private bool PassesFilter(TreeNode node)
        {
            var nodeText = node.Text.Split('(')[0]; // trim everything after first (, we do not want to use it in search

            if (nodeText.IndexOf(_filter, StringComparison.OrdinalIgnoreCase) >= 0)
            {
                return(true);
            }

            else // behave in 'special' way for dots, and capitals, the same way as resharper does
                 // let's Met.Ent match also METadata...ENTity
                 // also Met.EntNa should match Metadata.EntityName
            {
                var filter = SplitTextByCapsAndDot(_filter);
                var text   = SplitTextByCapsAndDot(nodeText);

                int textPivot = 0;

                for (int filterPivot = 0; filterPivot < filter.Count; filterPivot++)
                {
                    for (; textPivot <= text.Count; textPivot++)
                    {
                        if (textPivot == text.Count)
                        {
                            return(false);
                        }

                        if (text[textPivot].StartsWith(filter[filterPivot], StringComparison.OrdinalIgnoreCase))
                        {
                            break;
                        }
                    }
                    textPivot++;
                }

                return(true);
            }
        }
コード例 #35
0
        /// <summary>
        /// 添加TreeView的节点信息
        /// </summary>
        /// <param name="preID">上级科目编码</param>
        /// <param name="curNode">上级节点</param>
        public void InsertNode(System.Windows.Forms.TreeNode node, string preID)
        {
            ArrayList al = new ArrayList();

            try
            {
                //取子节点信息
                al = this.matBase.GetMetKindByPreID(preID);
                if (al == null)
                {
                    MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("加载物资科室信息发生错误") + this.matBase.Err);
                    return;
                }

                if (al.Count <= 0)
                {
                    return;
                }

                //添加子节点信息
                foreach (Neusoft.HISFC.Models.Material.MaterialKind materialKind in al)
                {
                    TreeNode kindTree = new TreeNode(materialKind.Name, 0, 0);
                    kindTree.Tag = materialKind.ID;
                    node.Nodes.Add(kindTree);

                    if (!materialKind.EndGrade)
                    {
                        this.InsertNode(kindTree, materialKind.ID);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("添加节点失败:" + e.Message);
                return;
            }
        }
コード例 #36
0
        public void filltProd(object objTreeView, object obimage)
        {
            try
            {
                _getSqlConnection getConnection = new _getSqlConnection();
                conn = getConnection.GetCon();
                string strSecar = "select * from tb_JhGoodsInfo where Falg=0";
                cmd   = new SqlCommand(strSecar, conn);
                qlddr = cmd.ExecuteReader();

                if (objTreeView.GetType().ToString() == "System.Windows.Forms.TreeView")
                {
                    System.Windows.Forms.ImageList imlist = (System.Windows.Forms.ImageList)obimage;

                    System.Windows.Forms.TreeView TV = (System.Windows.Forms.TreeView)objTreeView;
                    TV.Nodes.Clear();

                    TV.ImageList = imlist;
                    System.Windows.Forms.TreeNode TN = TV.Nodes.Add("A", "商品名称", 0, 1);

                    while (qlddr.Read())
                    {
                        TreeNode newNode12 = new TreeNode(qlddr[0].ToString(), 0, 1);
                        newNode12.Nodes.Add("A", qlddr[4].ToString(), 0, 1);
                        TN.Nodes.Add(newNode12);
                    }



                    qlddr.Close();
                    TV.ExpandAll();
                }
            }//
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }// end fi
コード例 #37
0
        private void removeZhanCe(System.Windows.Forms.TreeView trv)
        {
            for (int i = 0; i < trv.Nodes.Count; i++)
            {
                System.Windows.Forms.TreeNode trN = trv.Nodes[i];

                for (int j = 0; j < trN.Nodes.Count; j++)
                {
                    System.Windows.Forms.TreeNode trNEx = trN.Nodes[j];

                    for (int z = 0; z < trNEx.Nodes.Count; z++)
                    {
                        string strWellName = trNEx.Nodes[z].Text.Trim();
                        int    iDex        = strWellName.IndexOf("|");

                        string strSql = string.Format("select count(*) from tbWell where wellName='{0}' and not bSal is null", strWellName.Substring(iDex + 1));

                        string strCount = BengZhan.CDBConnection.ExecuteScalar(strSql).Trim();

                        if ((strCount == "") || (strCount == "0"))
                        {
                        }
                        else
                        {
                            trNEx.Nodes.RemoveAt(z);
                            z--;
                        }



                        //						if(trNEx.Nodes[z].Text.IndexOf("售水")>=0)
                        //						{
                        //
                        //						}
                    }
                }
            }
        }
コード例 #38
0
        private void BuildTreeView()
        {
            TreeNode appNameNode = new System.Windows.Forms.TreeNode("Name");

            appNameNode.Text = appName;
            TreeNode[] resourcesNodes = new TreeNode[misPackage.ResourcesCount];
            for (int i = 0; i < misPackage.Resources.Count; i++)
            {
                TreeNode treeNodeResource = new System.Windows.Forms.TreeNode(misPackage.Resources[i]);
                treeNodeResource.Text = misPackage.Resources[i];
                resourcesNodes[i]     = treeNodeResource;
            }
            TreeNode resorcesNode = new System.Windows.Forms.TreeNode("Resources", resourcesNodes);
            TreeNode msiNode      = new System.Windows.Forms.TreeNode("Msi", new TreeNode[] {
                appNameNode,
                resorcesNode
            });

            this.treeView1.Nodes.Add(msiNode);
            this.treeView1.ExpandAll();
            this.treeView1.SelectedNode = msiNode;
            this.treeView1.Focus();
        }
コード例 #39
0
        public void MoveDownButton_Click_WhenParentOfSelectedNodeIsNull_MovesDownTheSelectedNode()
        {
            // Arrange
            var node01 = new WinForms.TreeNode("node01");
            var node02 = new WinForms.TreeNode("node02");
            var node03 = new WinForms.TreeNode("node03");

            _treeViewMenu.Nodes.Add(node01);
            _treeViewMenu.Nodes.Add(node02);
            _treeViewMenu.Nodes.Add(node03);

            _treeViewMenu.SelectedNode = node02;

            var expectedSelectedNodeIndex = _treeViewMenu.SelectedNode.Index + 1;
            var expectedSelectedNodeText  = _treeViewMenu.SelectedNode.Text;

            // Act
            _menuBuilderPrivateObject.Invoke("_bMoveDown_Click", null, EventArgs.Empty);

            // Assert
            _treeViewMenu.SelectedNode.Index.ShouldBe(expectedSelectedNodeIndex);
            _treeViewMenu.SelectedNode.Text.ShouldBe(expectedSelectedNodeText);
        }
コード例 #40
0
 private void treeViewLeft_MouseClick(object sender, MouseEventArgs e)
 {
     this.treeViewLeft.Select();
     System.Windows.Forms.TreeNode currentNode = this.treeViewLeft.SelectedNode;
     if (lastNode != null)
     {
         if (currentNode.Equals(lastNode))
         {
             return;
         }
     }
     //不是点的同一个就清空
     if (lastNode.Name != currentNode.Name && currentNode.Nodes.Count > 0)
     {
         foreach (System.Windows.Forms.TreeNode temp in currentNode.Nodes)
         {
             temp.Remove();
         }
     }
     showMain(currentNode);
     //   showSonView(currentNode.Parent.Name);
     lastNode = currentNode;
 }
コード例 #41
0
        private void PVNode(TreeNode nParent, VPL.Execute.TreeNode Node, bool ShowName)
        {
            nParent.Collapse();
            TreeNode nd;

            if (ShowName)
            {
                nd = nParent.Nodes.Add(string.Format("{0} = {1}", Node.Name, Node.Item.ToString()));
            }
            else
            {
                nd = nParent.Nodes.Add(Node.Item.ToString());
            }
            if (Node._Children != null)
            {
                nd.Tag = Node;
                nd.Nodes.Add("<Enumerating>");
            }
            else
            {
                nd.Tag = Node.Item;
            }
        }
コード例 #42
0
ファイル: ObjectExplorer.cs プロジェクト: syn-ianp/OrionSDK
        void _tree_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node.Tag is Verb verb)
            {
                e.Node.Nodes.Clear();

                foreach (var arg in FindProvider(e.Node).GetVerbArguments(verb))
                {
                    string text    = $"{arg.Name} ({arg.Type})";
                    var    argNode = new TreeNode(text)
                    {
                        SelectedImageKey = "Argument"
                    };
                    argNode.ImageKey = argNode.SelectedImageKey;
                    argNode.Tag      = arg;
                    if (!string.IsNullOrEmpty(arg.Summary))
                    {
                        argNode.ToolTipText = arg.Summary;
                    }
                    e.Node.Nodes.Add(argNode);
                }
            }
        }
コード例 #43
0
        public void ShowUserList()
        {
            var users = new LogOnC();

            treeView1.Nodes.Clear();
            foreach (UserM user in users.GetUser())
            {
                if (user.Id != 1)
                {
                    var treeNo = new System.Windows.Forms.TreeNode(user.UserName);
                    this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
                        treeNo
                    });
                }
                DisEnable();
                btnremove.Enabled = false;
                btnedit.Enabled   = false;

                btnew.Enabled = true;
            }

            SetComboRule();
        }
コード例 #44
0
    // <summary>
    // Called after a node is checked.  Forces all children to inherit current state, and notifies parents they may need to become 'mixed'
    // </summary>
    protected override void OnAfterCheck(System.Windows.Forms.TreeViewEventArgs e)
    {
        base.OnAfterCheck(e);

        if (IgnoreClickAction > 0)
        {
            return;
        }

        IgnoreClickAction++;            // we're making changes to the tree, ignore any other change requests

        // the checked state has already been changed, we just need to update the state index

        // node is either ticked or unticked.  ignore mixed state, as the node is still only ticked or unticked regardless of state of children
        System.Windows.Forms.TreeNode tn = e.Node;
        tn.StateImageIndex = tn.Checked ? (int)CheckedState.Checked : (int)CheckedState.UnChecked;

        // force all children to inherit the same state as the current node
        UpdateChildState(e.Node.Nodes, e.Node.StateImageIndex, e.Node.Checked, false);
        // populate state up the tree, possibly resulting in parents with mixed state
        UpdateParentState(e.Node.Parent);
        IgnoreClickAction--;
    }
コード例 #45
0
        public void AddDepartment(DepartmentCS newDepartment)
        {
            var newNode = new System.Windows.Forms.TreeNode()
            {
                Name = newDepartment.Name,
                Tag  = newDepartment,
                Text = newDepartment.ToString()
            };

            if (newDepartment.ParentDepartmentID == null)
            {
                this.Nodes.Add(newNode);
            }
            else
            {
                TreeNode node = this.Nodes.FindByTag(new DepartmentCS()
                {
                    ID = newDepartment.ParentDepartmentID.Value
                });
                node.Nodes.Add(newNode);
            }
            this.SelectedNode = newNode;
        }
        public virtual void PerformChildSiblingButtonClickEventOperations()
        {
            var selectedIndex = TreeViewMenu.SelectedNode.Index;
            var selectedNode  = (WinForms.TreeNode)TreeViewMenu.SelectedNode.Clone();

            if (TreeViewMenu.SelectedNode.Parent == null)
            {
                WinForms.TreeNode previousNode = TreeViewMenu.Nodes[selectedIndex - 1];
                previousNode.Nodes.Add(selectedNode);
                previousNode.Expand();
                TreeViewMenu.Nodes.RemoveAt(selectedIndex);
            }
            else
            {
                WinForms.TreeNode previousNode = TreeViewMenu.SelectedNode.Parent.Nodes[selectedIndex - 1];
                previousNode.Nodes.Add(selectedNode);
                previousNode.Expand();
                TreeViewMenu.SelectedNode.Parent.Nodes.RemoveAt(selectedIndex);
            }

            TreeViewMenu.SelectedNode = selectedNode;
            TreeViewMenu.Focus();
        }
コード例 #47
0
 public static System.Windows.Forms.TreeNode GetTreeViewNodeFromPath(TreeNodeCollection nodes, string path, TreeView tvPD2)
 {
     System.Windows.Forms.TreeNode foundNode = null;
     foreach (System.Windows.Forms.TreeNode tn in nodes)
     {
         if (tn.FullPath == path)
         {
             tvPD2.SelectedNode = tn;
             tvPD2.SelectedNode.EnsureVisible();
             tvPD2.Focus();
             return(tn);
         }
         else if (tn.Nodes.Count > 0)
         {
             foundNode = GetTreeViewNodeFromPath(tn.Nodes, path, tvPD2);
         }
         if (foundNode != null)
         {
             return(foundNode);
         }
     }
     return(null);
 }
コード例 #48
0
ファイル: WorldEditor.cs プロジェクト: sandboxgod/GODZ-Engine
        //Builds a Tree that contains information about a Layer and child layers
        public static void buildLayersTree(TreeView treeView, String worldName, TabPanelData data, ContextMenuStrip menuStrip, ContextMenuStrip childNodeMenu)
        {
            treeView.Nodes.Clear();

            //add the root level node
            System.Windows.Forms.TreeNode levelNode = new System.Windows.Forms.TreeNode(worldName);
            levelNode.Checked = true;

            //Menu -> Add Layer option
            levelNode.ContextMenuStrip = menuStrip;
            treeView.Nodes.Add(levelNode);

            //now add all the child regions...
            List <GodzGlue.Layer> layers = new List <GodzGlue.Layer>();

            data.mWorld.getLayers(layers);

            //now go through the database; find the string name for the layer
            foreach (GodzGlue.Layer layer in layers)
            {
                addLayerToTree(layer, treeView, data, childNodeMenu, levelNode);
            }
        }
コード例 #49
0
ファイル: Main.cs プロジェクト: akinomyoga/Hanyu
        private void treePart_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            //GetDropTarget
            System.Windows.Forms.TreeNode tn = this.treePart.GetNodeAt(
                this.treePart.PointToClient(new System.Drawing.Point(e.X, e.Y))
                );
            if (tn == null || tn.Tag == null || tn.Tag.GetType() != typeof(System.Xml.XmlElement))
            {
                return;
            }
            string className = (string)(XmlPart.Elem)(System.Xml.XmlElement) tn.Tag;

            //GetDropObject
            if (!e.Data.GetDataPresent(typeof(System.Windows.Forms.ListView.SelectedListViewItemCollection)))
            {
                return;
            }
            System.Windows.Forms.ListView.SelectedListViewItemCollection items
                = (System.Windows.Forms.ListView.SelectedListViewItemCollection)
                  e.Data.GetData(typeof(System.Windows.Forms.ListView.SelectedListViewItemCollection));
            //SetClass
            for (int i = 0; i < items.Count; i++)
            {
                if (!items[i].Tag.GetType().IsSubclassOf(typeof(Hanyu.Word.Content)))
                {
                    continue;
                }
                ((Hanyu.Word.Content)items[i].Tag).Class.Add(className);
            }
            //DropTarget を元に戻す
            if (this.treePartDropTarget == null)
            {
                return;
            }
            this.treePartDropTarget.NodeFont = this.FontDefault;
            this.treePartDropTarget          = null;
        }
コード例 #50
0
 private void BrowseTV_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         System.Windows.Forms.TreeNode nodeAt = this.BrowseTV.GetNodeAt(e.X, e.Y);
         if (nodeAt != null)
         {
             this.PickMI.Enabled            = false;
             this.EditFiltersMI.Enabled     = false;
             this.RefreshMI.Enabled         = false;
             this.SetLoginMI.Enabled        = false;
             this.ConnectMI.Enabled         = false;
             this.DisconnectMI.Enabled      = false;
             this.ViewComplexTypeMI.Enabled = false;
             if (nodeAt == this.m_localNetwork || this.IsHostNode(nodeAt))
             {
                 this.RefreshMI.Enabled  = true;
                 this.SetLoginMI.Enabled = true;
             }
             else if (this.IsServerNode(nodeAt))
             {
                 this.PickMI.Enabled        = true;
                 this.ConnectMI.Enabled     = !((Opc.Da.Server)nodeAt.Tag).IsConnected;
                 this.DisconnectMI.Enabled  = ((Opc.Da.Server)nodeAt.Tag).IsConnected;
                 this.EditFiltersMI.Enabled = true;
                 this.RefreshMI.Enabled     = true;
             }
             else if (this.IsBrowseElementNode(nodeAt))
             {
                 this.PickMI.Enabled            = true;
                 this.EditFiltersMI.Enabled     = true;
                 this.RefreshMI.Enabled         = true;
                 this.ViewComplexTypeMI.Enabled = (ComplexTypeCache.GetComplexItem((BrowseElement)nodeAt.Tag) != null);
             }
         }
     }
 }
コード例 #51
0
        public void showSonNode(System.Windows.Forms.TreeNode currentNode)
        {
            System.Windows.Forms.TreeNode treeNode;
            string     sonNodeName;
            SqlCommand sqlcmd = new SqlCommand();

            Tools.DataBase db1    = new Tools.DataBase();
            SqlConnection  sqlcon = db1.getConnection();

            sqlcon.Open();
            sqlcmd.Connection = sqlcon;
            string last = "";

            if (currentNode.Name == "agentGroup")
            {
                sqlcmd.CommandText = "select [TS_GROUP_NAME] as nodeId from [TS_AGENT_GROUP] order by TS_GROUP_ID";
                last = "组";
            }


            System.Data.SqlClient.SqlDataReader SDR = sqlcmd.ExecuteReader();
            while (SDR.Read())
            {
                //  SDR.NextResult();
                sonNodeName = SDR["nodeId"].ToString();
                treeNode    = new System.Windows.Forms.TreeNode(sonNodeName);

                treeNode.Name = currentNode.Name + "<" + sonNodeName;
                treeNode.Text = sonNodeName + last;
                if (!currentNode.Nodes.ContainsKey(treeNode.Name))
                {
                    currentNode.Nodes.Add(treeNode);
                }
            }
            sqlcmd.Dispose();
            sqlcon.Dispose();
        }
コード例 #52
0
 /// <summary>
 /// Required method for Designer support - do not modify
 ///   the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Move analysis will be recorded when the next move begins. WARNING: drastically sl" +
                                                                                 "ows computer thinking, and uses LOTS of memory!");
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMoveAnalysis));
     this.tvwMoves = new System.Windows.Forms.TreeView();
     this.SuspendLayout();
     //
     // tvwMoves
     //
     this.tvwMoves.BackColor = System.Drawing.SystemColors.Window;
     this.tvwMoves.Dock      = System.Windows.Forms.DockStyle.Fill;
     this.tvwMoves.Location  = new System.Drawing.Point(0, 0);
     this.tvwMoves.Name      = "tvwMoves";
     treeNode1.Name          = "";
     treeNode1.Text          = "Move analysis will be recorded when the next move begins. Max depth 6. WARNING: drastically slows computer thinking, and uses LOTS of memory!";
     this.tvwMoves.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
         treeNode1
     });
     this.tvwMoves.Size          = new System.Drawing.Size(475, 592);
     this.tvwMoves.TabIndex      = 64;
     this.tvwMoves.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvwMoves_BeforeExpand);
     this.tvwMoves.AfterExpand  += new System.Windows.Forms.TreeViewEventHandler(this.tvwMoves_AfterExpand);
     this.tvwMoves.AfterSelect  += new System.Windows.Forms.TreeViewEventHandler(this.tvwMoves_AfterSelect);
     //
     // frmMoveAnalysis
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(475, 592);
     this.Controls.Add(this.tvwMoves);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name            = "frmMoveAnalysis";
     this.Text            = "Move Analysis Tree";
     this.Closing        += new System.ComponentModel.CancelEventHandler(this.frmMoveAnalysis_Closing);
     this.ResumeLayout(false);
 }
コード例 #53
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="result"></param>
        private void fillTreefriend(
            IAsyncResult result)
        {
            #region
            MethodInvoker dl_do = (MethodInvoker)result.AsyncState;
            dl_do.EndInvoke(result);


            if (!this.InvokeRequired)
            {
                return;
            }

            this.Invoke(new MethodInvoker(() => {
                this.tFriend.Nodes.Clear();
                XmlDataDocument Xmldate = new XmlDataDocument();
                Xmldate.Load("online.dat");
                XmlNode root = Xmldate.DocumentElement;
                for (int i = 0; i < root.ChildNodes.Count; i++)
                {
                    XmlNode group = root.ChildNodes[i];
                    System.Windows.Forms.TreeNode father = new System.Windows.Forms.TreeNode();
                    father.Text               = group.Attributes[GroupData.groupName].Value;
                    father.ImageIndex         = 2;
                    father.SelectedImageIndex = 2;
                    this.tFriend.Nodes.Add(father);
                    fillFriendsChild(i, group);
                }
            }));

            //测试注册侦听
            MethodInvoker gd = new MethodInvoker(() => {
                (new ChatClient()).RegisterListen(_iconController);
            });
            gd.BeginInvoke(null, null);
            #endregion
        }
コード例 #54
0
ファイル: WMIControl.cs プロジェクト: zoroz/Terminals
        private void LoadBasicTree(string xml)
        {
            this.progressBar1.Value = 0;

            this.IncrementBar();
            treeView2.Nodes.Clear();
            Application.DoEvents();
            this.IncrementBar();
            Application.DoEvents();

            this.IncrementBar();
            Application.DoEvents();
            System.Xml.XmlDocument x = new System.Xml.XmlDocument();
            try
            {
                x.LoadXml(xml);
            }
            catch (Exception xexc)
            {
                Terminals.Logging.Error("Load Basic Tree Failed", xexc);
            }

            System.Xml.XmlNode            n    = x.SelectSingleNode("/tree");
            System.Windows.Forms.TreeNode root = new System.Windows.Forms.TreeNode();
            this.treeView2.Nodes.Add(root);
            Application.DoEvents();

            this.LoadNode(n, root);

            root.Expand();
            if (root.Nodes != null && root.Nodes.Count > 0)
            {
                root.Nodes[0].Expand();
            }

            this.progressBar1.Value = 0;
        }
コード例 #55
0
        public System.Windows.Forms.TreeNode GetFolders(string directoryValue, System.Windows.Forms.TreeNode parentNode)
        {
            // array stores all subdirectories in the directory
            string[] directoryArray = Directory.GetDirectories(directoryValue);
            try
            {
                if (directoryArray.Length != 0)
                {
                    // for every subdirectory, create new TreeNode,
                    // add as a child of current node and recursively
                    // populate child nodes with subdirectories
                    foreach (string directory in directoryArray)
                    {
                        // obtain last part of path name from the full path
                        // name by calling the GetFileNameWithoutExtension
                        // method of class Path
                        string substringDirectory = Path.GetFileNameWithoutExtension(directory);

                        // create TreeNode for current directory
                        TreeNode myNode = new TreeNode(substringDirectory);

                        // add current directory node to parent node
                        parentNode.Nodes.Add(myNode);

                        // recursively populate every subdirectory
                        GetFolders(directory, myNode);
                    } // end foreach
                }     // end if
            }         // end try

            // catch exception
            catch (UnauthorizedAccessException)
            {
                parentNode.Nodes.Add("Access denied");
            } // end catch
            return(parentNode);
        }
コード例 #56
0
        ///<Summary>Given a CShItem, find the TreeNode that belongs to the
        /// equivalent (matching PIDL) CShItem's most immediate surviving ancestor.
        ///  Note: referential comparison might not work since there is no guarantee
        /// that the exact same CShItem is stored in the tree.</Summary>
        ///<returns> Me.Root if not found, otherwise the Treenode whose .Tag is
        /// equivalent to the input CShItem's most immediate surviving ancestor </returns>
        private TreeNode FindAncestorNode(CShItem CSI)
        {
            TreeNode returnValue;

            returnValue = null;
            if (!CSI.IsFolder)
            {
                return(returnValue);                //only folders in tree
            }
            System.Windows.Forms.TreeNode baseNode = Root;
            //Dim cp As cPidl = CSI.clsPidl     'the cPidl rep of the PIDL to be found
            TreeNode testNode;
            int      lim = ExpTreeLib.CShItem.PidlCount(CSI.PIDL) - ExpTreeLib.CShItem.PidlCount((baseNode.Tag as CShItem).PIDL);

            while (lim > 1)
            {
                foreach (TreeNode tempLoopVar_testNode in baseNode.Nodes)
                {
                    testNode = tempLoopVar_testNode;
                    if (CShItem.IsAncestorOf(testNode.Tag as CShItem, CSI, false))
                    {
                        baseNode = testNode;
                        baseNode.Expand();
                        lim--;
                        goto NEXTLEV;
                    }
                }
                //CSI's Ancestor may have moved or been deleted, return the last one
                // found (if none, will return Me.Root)
                return(baseNode);

NEXTLEV:
                1.GetHashCode();                  //nop
            }
            //on fall thru, we have it
            return(baseNode);
        }
コード例 #57
0
 private void AddBinding()
 {
     System.Windows.Forms.TreeNode selectedNode = this._schemaTreeView.SelectedNode;
     if (selectedNode != null)
     {
         TreeNodeBinding binding = new TreeNodeBinding();
         if (selectedNode.Text != this._schemaTreeView.Nodes[0].Text)
         {
             binding.DataMember = selectedNode.Text;
             if (((SchemaTreeNode)selectedNode).Duplicate)
             {
                 binding.Depth = selectedNode.FullPath.Split(new char[] { this._schemaTreeView.PathSeparator[0] }).Length - 1;
             }
             ((IDataSourceViewSchemaAccessor)binding).DataSourceViewSchema = ((SchemaTreeNode)selectedNode).Schema;
             int index = this._bindingsListView.Items.IndexOf(binding);
             if (index == -1)
             {
                 this._bindingsListView.Items.Add(binding);
                 this._bindingsListView.SetSelected(this._bindingsListView.Items.Count - 1, true);
             }
             else
             {
                 binding = (TreeNodeBinding)this._bindingsListView.Items[index];
                 this._bindingsListView.SetSelected(index, true);
             }
         }
         else
         {
             this._bindingsListView.Items.Add(binding);
             this._bindingsListView.SetSelected(this._bindingsListView.Items.Count - 1, true);
         }
         this._propertyGrid.SelectedObject = binding;
         this._propertyGrid.Refresh();
         this.UpdateEnabledStates();
     }
     this._bindingsListView.Focus();
 }
コード例 #58
0
        public void TreeViewMenu_AfterSelect_SetsButtonsEnabledStatus_WhenParentOfSelectedNodeIsNullAndLastNodeSelected()
        {
            // Arrange
            var node01 = new WinForms.TreeNode();
            var node02 = new WinForms.TreeNode();

            _treeViewMenu.Nodes.Add(node01);
            _treeViewMenu.Nodes.Add(node02);

            _treeViewMenu.SelectedNode     = node02;
            _treeViewMenu.SelectedNode.Tag = _menuItemProperty;

            // Act
            _menuBuilderPrivateObject.Invoke("_tvMenu_AfterSelect", null, new WinForms.TreeViewEventArgs(null));

            // Assert
            _btnMoveUp.Enabled.ShouldBeTrue();
            _btnMoveDown.Enabled.ShouldBeFalse();
            _btnChildSibling.Enabled.ShouldBeTrue();
            _btnSiblingParent.Enabled.ShouldBeFalse();
            _btnAddChild.Enabled.ShouldBeTrue();
            _btnRemoveNode.Enabled.ShouldBeTrue();
            _propertyGridMenu.SelectedObject.ShouldBeSameAs(_menuItemProperty);
        }
コード例 #59
0
ファイル: TreeViewHandler.cs プロジェクト: wnf0000/Eto
        void PerformPopulateNodes(System.Windows.Forms.TreeNodeCollection nodes, ITreeStore item)
        {
            nodes.Clear();
            if (item == null)
            {
                return;
            }
            var count = item.Count;

            for (int i = 0; i < count; i++)
            {
                var child = item[i];
                var node  = new swf.TreeNode
                {
                    Text = child.Text,
                    Name = child.Key,
                    Tag  = child,
                };
                SetImage(child, node);

                if (child.Expandable)
                {
                    if (child.Expanded)
                    {
                        PerformPopulateNodes(node.Nodes, child);
                        node.Expand();
                    }
                    else
                    {
                        node.Nodes.Add(EmptyName, string.Empty);
                    }
                }

                nodes.Add(node);
            }
        }
コード例 #60
0
ファイル: FrmSupplierManage.cs プロジェクト: honstat/mvctest
        private void binddata()
        {
            tv.Nodes.Clear();

            tv.ImageList = this.imglist;
            System.Windows.Forms.TreeNode TN = new System.Windows.Forms.TreeNode("供应商名称", 0, 1);

            int             total = 0;
            List <Supplier> list  = SupplierDAL.Getlist("", 0, out total);

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    TN.Nodes.Add("", item.Name.ToString(), 0, 1);
                }
            }



            tv.Nodes.Add(TN);

            tv.ExpandAll();
        }