public RadTreeNode UpdateCategoryNode(RadTreeNode categoryNode) { //categoryNode.Tag = categoryInfo; NCategoryInfo categoryInfo = new NCategoryInfo(); categoryInfo.CategoryName = categoryNode.Text; categoryNode.Tag = categoryInfo; categoryNode.Image = Properties.Resources.CatalogIcon.GetThumbnailImage(40, 40, null, IntPtr.Zero); categoryNode.ItemHeight = 50; categoryNode.Font = new Font(Lev1NodeFont, 12); categoryNode.ShowCheckBox = false; categoryNode.Selected = true; categoryNode.TextAlignment = ContentAlignment.MiddleCenter; categoryNode.ContextMenu = categoryContextMenu; return(categoryNode); }
private void BatchAddCategory_Click(object sender, EventArgs e) { RadTreeNode parentNode = sender as RadTreeNode; UCCategory ctrl = new UCCategory(); FormContainer container = new FormContainer(); container.SetControl(ctrl); if ((container.ShowDialog() == DialogResult.OK) && !(navigateTree.SelectedNode.Tag is NFileInfo)) { NCategoryInfo categoryInfo = new NCategoryInfo(ctrl.CategoryName); RadTreeNode categoryNode = CreateCategoryNode(parentNode, categoryInfo); categoryNode.ContextMenu = this.categoryContextMenu; navigateTree.Refresh(); navigateTree.SelectedNode.ExpandAll(); Application.DoEvents(); categoryNode.Selected = true; //categoryNode.ExpandAll(); Application.DoEvents(); } }
public RadTreeNode CreateCategoryNode(RadTreeNode parentNode, NCategoryInfo categoryInfo) { //RadTreeNode node = parentNode.Nodes.Add(categoryInfo.CategoryName); int index = parentNode.GetNextCategoryIndex(); RadTreeNode node = new RadTreeNode() { Text = categoryInfo.CategoryName }; node.Tag = categoryInfo; node.Image = Properties.Resources.CatalogIcon.GetThumbnailImage(40, 40, null, IntPtr.Zero); node.ItemHeight = 50; node.Font = new Font(Lev1NodeFont, 12); node.ShowCheckBox = false; node.Selected = true; parentNode.Nodes.Insert(index, node); //parentNode.Nodes.Move(navigateTree.SelectedNode.Nodes.Count - 1, 0); navigateTree.Refresh(); //navigateTree.SelectedNode.ExpandAll(); return(node); }