当前位置: 首页>>代码示例>>C#>>正文


C# RtfTreeNode类代码示例

本文整理汇总了C#中RtfTreeNode的典型用法代码示例。如果您正苦于以下问题:C# RtfTreeNode类的具体用法?C# RtfTreeNode怎么用?C# RtfTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RtfTreeNode类属于命名空间,在下文中一共展示了RtfTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StringRepresentation

        public void StringRepresentation()
        {
            RtfTreeNode node = new RtfTreeNode(RtfNodeType.Keyword, "b", true, 3);
            RtfTreeNode node2 = new RtfTreeNode(RtfNodeType.Root);

            Assert.That(node.ToString(), Is.EqualTo("[Keyword, b, True, 3]"));
            Assert.That(node2.ToString(), Is.EqualTo("[Root, , False, 0]"));
        }
开发者ID:mnibecker,项目名称:nrtftree,代码行数:8,代码来源:RtfTreeNodeTest.cs

示例2: RtfTree

            /// <summary>
            /// Constructor de la clase RtfTree.
            /// </summary>
            public RtfTree()
            {
                //Se crea el nodo raíz del documento
                rootNode = new RtfTreeNode(RtfNodeType.Root);

				/* Inicializados por defecto */
                //Se inicializa la profundidad actual
                //level = 0;
            }
开发者ID:gipasoft,项目名称:Sfera,代码行数:12,代码来源:RtfTree.cs

示例3: EmptyNodeNavigation

        public void EmptyNodeNavigation()
        {
            RtfTreeNode node = new RtfTreeNode();

            Assert.That(node.Tree, Is.Null);
            Assert.That(node.RootNode, Is.Null);
            Assert.That(node.ParentNode, Is.Null);

            Assert.That(node.NextSibling, Is.Null);
            Assert.That(node.PreviousSibling, Is.Null);

            Assert.That(node.ChildNodes, Is.Null);

            Assert.That(node.FirstChild, Is.Null);
            Assert.That(node.LastChild, Is.Null);
        }
开发者ID:mnibecker,项目名称:nrtftree,代码行数:16,代码来源:NavigationTest.cs

示例4: InitNodeNavigation

        public void InitNodeNavigation()
        {
            RtfTreeNode node = new RtfTreeNode(RtfNodeType.Keyword, "rtf", true, 99);

            Assert.That(node.Tree, Is.Null);
            Assert.That(node.RootNode, Is.Null);
            Assert.That(node.ParentNode, Is.Null);

            Assert.That(node.NextSibling, Is.Null);
            Assert.That(node.PreviousSibling, Is.Null);

            Assert.That(node.ChildNodes, Is.Null);

            Assert.That(node.FirstChild, Is.Null);
            Assert.That(node.LastChild, Is.Null);
        }
开发者ID:mnibecker,项目名称:nrtftree,代码行数:16,代码来源:NavigationTest.cs

示例5: PopulateCollection

        public void PopulateCollection()
        {
            RtfNodeCollection list1 = new RtfNodeCollection();
            RtfNodeCollection list2 = new RtfNodeCollection();

            RtfTreeNode node = new RtfTreeNode(RtfNodeType.Keyword, "b", true, 2);

            list1.Add(new RtfTreeNode(RtfNodeType.Keyword, "a", true, 1));
            list1.Add(node);
            list1.Add(new RtfTreeNode(RtfNodeType.Keyword, "c", true, 3));
            list1.Add(new RtfTreeNode(RtfNodeType.Keyword, "d", true, 4));
            list1.Add(new RtfTreeNode(RtfNodeType.Keyword, "e", true, 5));

            list2.Add(node);
            list2.Add(new RtfTreeNode(RtfNodeType.Keyword, "g", true, 7));

            Assert.That(list1.Count, Is.EqualTo(5));
            Assert.That(list2.Count, Is.EqualTo(2));

            Assert.That(list1[1], Is.SameAs(node));
            Assert.That(list2[0], Is.SameAs(node));

            list1.AddRange(list2);

            Assert.That(list1.Count, Is.EqualTo(7));

            Assert.That(list1[5], Is.SameAs(list2[0]));
            Assert.That(list1[6], Is.SameAs(list2[1]));

            Assert.That(list1[6].NodeKey, Is.EqualTo("g"));
            Assert.That(list2[0], Is.SameAs(node));

            RtfTreeNode node1 = new RtfTreeNode(RtfNodeType.Keyword, "h", false, 8);

            list1.Insert(5, node1);

            Assert.That(list1.Count, Is.EqualTo(8));
            Assert.That(list1[5], Is.SameAs(node1));

            RtfTreeNode node2 = new RtfTreeNode(RtfNodeType.Keyword, "i", false, 9);

            list1[1] = node2;

            Assert.That(list1.Count, Is.EqualTo(8));
            Assert.That(list1[1], Is.SameAs(node2));
        }
开发者ID:mnibecker,项目名称:nrtftree,代码行数:46,代码来源:NodeCollectionTest.cs

示例6: AdjacentNodes

        public void AdjacentNodes()
        {
            //Creación de un árbol sencillo

            RtfTree tree = new RtfTree();

            RtfTreeNode mainGroup = new RtfTreeNode(RtfNodeType.Group);
            RtfTreeNode rtfNode = new RtfTreeNode(RtfNodeType.Keyword, "rtf", true, 0);
            mainGroup.AppendChild(rtfNode);

            RtfTreeNode newGroup = new RtfTreeNode(RtfNodeType.Group);
            RtfTreeNode node1 = new RtfTreeNode(RtfNodeType.Keyword, "ul", false, 0);
            RtfTreeNode node2 = new RtfTreeNode(RtfNodeType.Text, "Test", false, 0);
            RtfTreeNode node3 = new RtfTreeNode(RtfNodeType.Keyword, "ulnone", false, 0);

            newGroup.AppendChild(node1);
            newGroup.AppendChild(node2);
            newGroup.AppendChild(node3);

            mainGroup.AppendChild(newGroup);

            tree.RootNode.AppendChild(mainGroup);

            RtfTreeNode node4 = new RtfTreeNode(RtfNodeType.Text, "fin", false, 0);

            mainGroup.AppendChild(node4);

            Assert.That(tree.RootNode.NextNode, Is.SameAs(mainGroup));
            Assert.That(mainGroup.NextNode, Is.SameAs(rtfNode));
            Assert.That(rtfNode.NextNode, Is.SameAs(newGroup));
            Assert.That(newGroup.NextNode, Is.SameAs(node1));
            Assert.That(node1.NextNode, Is.SameAs(node2));
            Assert.That(node2.NextNode, Is.SameAs(node3));
            Assert.That(node3.NextNode, Is.SameAs(node4));
            Assert.That(node4.NextNode, Is.Null);

            Assert.That(node4.PreviousNode, Is.SameAs(node3));
            Assert.That(node3.PreviousNode, Is.SameAs(node2));
            Assert.That(node2.PreviousNode, Is.SameAs(node1));
            Assert.That(node1.PreviousNode, Is.SameAs(newGroup));
            Assert.That(newGroup.PreviousNode, Is.SameAs(rtfNode));
            Assert.That(rtfNode.PreviousNode, Is.SameAs(mainGroup));
            Assert.That(mainGroup.PreviousNode, Is.SameAs(tree.RootNode));
            Assert.That(tree.RootNode.PreviousNode, Is.Null);
        }
开发者ID:Bartizan,项目名称:nrtftree,代码行数:45,代码来源:NavigationTest.cs

示例7: AddChildToEmptyNode

        public void AddChildToEmptyNode()
        {
            RtfTreeNode node = new RtfTreeNode();

            Assert.That(node.ChildNodes, Is.Null);

            RtfTreeNode childNode = new RtfTreeNode();
            node.InsertChild(0, childNode);

            Assert.That(node.ChildNodes, Is.Not.Null);
            Assert.That(node.ChildNodes[0], Is.SameAs(childNode));
            Assert.That(childNode.ChildNodes, Is.Null);

            RtfTreeNode anotherChildNode = new RtfTreeNode();
            childNode.AppendChild(anotherChildNode);

            Assert.That(childNode.ChildNodes, Is.Not.Null);
            Assert.That(childNode.ChildNodes[0], Is.SameAs(anotherChildNode));
        }
开发者ID:mnibecker,项目名称:nrtftree,代码行数:19,代码来源:RtfTreeNodeTest.cs

示例8: ObjectNode

            /// <summary>
            /// Constructor de la clase ObjectNode.
            /// </summary>
            /// <param name="node">Nodo RTF del que se obtendrán los datos de la imagen.</param>
            public ObjectNode(RtfTreeNode node)
            {
                if(node != null)
                {
                    //Asignamos todos los campos del nodo
                    this.NodeKey = node.NodeKey;
                    this.HasParameter = node.HasParameter;
                    this.Parameter= node.Parameter;
                    this.ParentNode = node.ParentNode;
                    this.RootNode = node.RootNode;
                    this.NodeType = node.NodeType;

                    this.ChildNodes.Clear();
                    this.ChildNodes.AddRange(node.ChildNodes);

                    //Obtenemos los datos del objeto como un array de bytes
                    getObjectData();
                }
            }
开发者ID:nitinthewiz,项目名称:Nodepad,代码行数:23,代码来源:ObjectNode.cs

示例9: ImageNode

            /// <summary>
            /// Constructor de la clase ImageNode.
            /// </summary>
            /// <param name="node">Nodo RTF del que se obtendrán los datos de la imagen.</param>
            public ImageNode(RtfTreeNode node)
            {
                if(node != null)
                {
                    //Asignamos todos los campos del nodo
                    NodeKey = node.NodeKey;
                    HasParameter = node.HasParameter;
                    Parameter = node.Parameter;
                    ParentNode = node.ParentNode;
                    RootNode = node.RootNode;
                    NodeType = node.NodeType;

                    ChildNodes = new RtfNodeCollection();
                    ChildNodes.AddRange(node.ChildNodes);

                    //Obtenemos los datos de la imagen como un array de bytes
                    getImageData();
                }
            }
开发者ID:Bartizan,项目名称:nrtftree,代码行数:23,代码来源:ImageNode.cs

示例10: SimpleTreeNavigation

        public void SimpleTreeNavigation()
        {
            //Creación de un árbol sencillo

            RtfTree tree = new RtfTree();

            RtfTreeNode mainGroup = new RtfTreeNode(RtfNodeType.Group);
            RtfTreeNode rtfNode = new RtfTreeNode(RtfNodeType.Keyword, "rtf", true, 0);
            mainGroup.AppendChild(rtfNode);

            RtfTreeNode newGroup = new RtfTreeNode(RtfNodeType.Group);
            RtfTreeNode node1 = new RtfTreeNode(RtfNodeType.Keyword, "ul", false, 0);
            RtfTreeNode node2 = new RtfTreeNode(RtfNodeType.Text, "Test", false, 0);
            RtfTreeNode node3 = new RtfTreeNode(RtfNodeType.Text, "ulnone", false, 0);

            newGroup.AppendChild(node1);
            newGroup.AppendChild(node2);
            newGroup.AppendChild(node3);

            mainGroup.AppendChild(newGroup);

            tree.RootNode.AppendChild(mainGroup);

            //Navegación básica: tree
            Assert.That(tree.RootNode, Is.Not.Null);
            Assert.That(tree.MainGroup, Is.SameAs(mainGroup));

            //Navegación básica: newGroup
            Assert.That(newGroup.Tree, Is.SameAs(tree));
            Assert.That(newGroup.ParentNode, Is.SameAs(mainGroup));
            Assert.That(newGroup.RootNode, Is.SameAs(tree.RootNode));
            Assert.That(newGroup.ChildNodes, Is.Not.Null);
            Assert.That(newGroup[1], Is.SameAs(node2));
            Assert.That(newGroup.ChildNodes[1], Is.SameAs(node2));
            Assert.That(newGroup["ul"], Is.SameAs(node1));
            Assert.That(newGroup.FirstChild, Is.SameAs(node1));
            Assert.That(newGroup.LastChild, Is.SameAs(node3));
            Assert.That(newGroup.PreviousSibling, Is.SameAs(rtfNode));
            Assert.That(newGroup.NextSibling, Is.Null);
            Assert.That(newGroup.Index, Is.EqualTo(1));

            //Navegación básica: nodo2
            Assert.That(node2.Tree, Is.SameAs(tree));
            Assert.That(node2.ParentNode, Is.SameAs(newGroup));
            Assert.That(node2.RootNode, Is.SameAs(tree.RootNode));
            Assert.That(node2.ChildNodes, Is.Null);
            Assert.That(node2[1], Is.Null);
            Assert.That(node2["ul"], Is.Null);
            Assert.That(node2.FirstChild, Is.Null);
            Assert.That(node2.LastChild, Is.Null);
            Assert.That(node2.PreviousSibling, Is.SameAs(node1));
            Assert.That(node2.NextSibling, Is.SameAs(node3));
            Assert.That(node2.Index, Is.EqualTo(1));
        }
开发者ID:mnibecker,项目名称:nrtftree,代码行数:54,代码来源:NavigationTest.cs

示例11: InsertGenerator

            /// <summary>
            /// Inserta el código RTF de la aplicación generadora del documento.
            /// </summary>
            private void InsertGenerator()
            {
                RtfTreeNode genGroup = new RtfTreeNode(RtfNodeType.Group);

                genGroup.AppendChild(new RtfTreeNode(RtfNodeType.Control, "*", false, 0));
                genGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "generator", false, 0));
                genGroup.AppendChild(new RtfTreeNode(RtfNodeType.Text, "NRtfTree Library 1.3.0;", false, 0));

                mainGroup.InsertChild(7, genGroup);
            }
开发者ID:sonygod,项目名称:dotahit,代码行数:13,代码来源:RtfDocument.cs

示例12: InsertColorTable

            /// <summary>
            /// Inserta el código RTF de la tabla de colores en el documento.
            /// </summary>
            private void InsertColorTable()
            {
                RtfTreeNode ctGroup = new RtfTreeNode(RtfNodeType.Group);

                ctGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "colortbl", false, 0));

                for (int i = 0; i < colorTable.Count; i++)
                {
                    ctGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "red", true, colorTable[i].R));
                    ctGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "green", true, colorTable[i].G));
                    ctGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "blue", true, colorTable[i].B));
                    ctGroup.AppendChild(new RtfTreeNode(RtfNodeType.Text, ";", false, 0));
                }

                mainGroup.InsertChild(6, ctGroup);
            }
开发者ID:sonygod,项目名称:dotahit,代码行数:19,代码来源:RtfDocument.cs

示例13: InsertFontTable

            /// <summary>
            /// Inserta el código RTF de la tabla de fuentes en el documento.
            /// </summary>
            private void InsertFontTable()
            {
                RtfTreeNode ftGroup = new RtfTreeNode(RtfNodeType.Group);

                ftGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "fonttbl", false, 0));

                for(int i=0; i<fontTable.Count; i++)
                {
                    RtfTreeNode ftFont = new RtfTreeNode(RtfNodeType.Group);
                    ftFont.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "f", true, i));
                    ftFont.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "fnil", false, 0));
                    ftFont.AppendChild(new RtfTreeNode(RtfNodeType.Text, fontTable[i] + ";", false, 0));

                    ftGroup.AppendChild(ftFont);
                }

                mainGroup.InsertChild(5, ftGroup);
            }
开发者ID:sonygod,项目名称:dotahit,代码行数:21,代码来源:RtfDocument.cs

示例14: AddImage

            /// <summary>
            /// Inserta una imagen en el documento.
            /// </summary>
            /// <param name="path">Ruta de la imagen a insertar.</param>
            /// <param name="width">Ancho deseado de la imagen en el documento.</param>
            /// <param name="height">Alto deseado de la imagen en el documento.</param>
            public void AddImage(string path, int width, int height)
            {
                FileStream fStream = null;
                BinaryReader br = null;

                try
                {
                    byte[] data = null;

                    FileInfo fInfo = new FileInfo(path);
                    long numBytes = fInfo.Length;

                    fStream = new FileStream(path, FileMode.Open, FileAccess.Read);
                    br = new BinaryReader(fStream);

                    data = br.ReadBytes((int)numBytes);

                    StringBuilder hexdata = new StringBuilder();

                    for (int i = 0; i < data.Length; i++)
                    {
                        hexdata.Append(GetHexa(data[i]));
                    }

                    Image img = Image.FromFile(path);

                    RtfTreeNode imgGroup = new RtfTreeNode(RtfNodeType.Group);
                    imgGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "pict", false, 0));

                    string format = "";
                    if (path.ToLower().EndsWith("wmf"))
                        format = "emfblip";
                    else
                        format = "jpegblip";

                    imgGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, format, false, 0));

                    imgGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "picw", true, img.Width * 20));
                    imgGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "pich", true, img.Height * 20));
                    imgGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "picwgoal", true, width * 20));
                    imgGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "pichgoal", true, height * 20));
                    imgGroup.AppendChild(new RtfTreeNode(RtfNodeType.Text, hexdata.ToString(), false, 0));

                    mainGroup.AppendChild(imgGroup);
                }
                finally
                {
                    br.Close();
                    fStream.Close();
                }
            }
开发者ID:sonygod,项目名称:dotahit,代码行数:57,代码来源:RtfDocument.cs

示例15: Clear

            public void Clear()
            {
                currentFormat = null;

                tree = new RtfTree();
                mainGroup = new RtfTreeNode(RtfNodeType.Group);

                InitializeTree();
            }
开发者ID:sonygod,项目名称:dotahit,代码行数:9,代码来源:RtfDocument.cs


注:本文中的RtfTreeNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。