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


C# Cell.Clone方法代码示例

本文整理汇总了C#中Cell.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.Clone方法的具体用法?C# Cell.Clone怎么用?C# Cell.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cell的用法示例。


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

示例1: CellCloneTest

        public void CellCloneTest()
        {
            int row = 3;
            int column = 3;
            char value = '-';
            Cell cell = new Cell(row, column, value);

            Assert.IsTrue(cell.Equals(cell.Clone()));
        }
开发者ID:Jarolim,项目名称:AllMyHomeworkForTelerikAcademy,代码行数:9,代码来源:Cell.tests.cs

示例2: Run

        public static void Run()
        {
            // ExStart:InsertTableDirectly
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_WorkingWithTables();

            Document doc = new Document();
            // We start by creating the table object. Note how we must pass the document object
            // To the constructor of each node. This is because every node we create must belong
            // To some document.
            Table table = new Table(doc);
            // Add the table to the document.
            doc.FirstSection.Body.AppendChild(table);

            // Here we could call EnsureMinimum to create the rows and cells for us. This method is used
            // To ensure that the specified node is valid, in this case a valid table should have at least one
            // Row and one cell, therefore this method creates them for us.

            // Instead we will handle creating the row and table ourselves. This would be the best way to do this
            // If we were creating a table inside an algorthim for example.
            Row row = new Row(doc);
            row.RowFormat.AllowBreakAcrossPages = true;
            table.AppendChild(row);

            // We can now apply any auto fit settings.
            table.AutoFit(AutoFitBehavior.FixedColumnWidths);

            // Create a cell and add it to the row
            Cell cell = new Cell(doc);
            cell.CellFormat.Shading.BackgroundPatternColor = Color.LightBlue;
            cell.CellFormat.Width = 80;

            // Add a paragraph to the cell as well as a new run with some text.
            cell.AppendChild(new Paragraph(doc));
            cell.FirstParagraph.AppendChild(new Run(doc, "Row 1, Cell 1 Text"));

            // Add the cell to the row.
            row.AppendChild(cell);

            // We would then repeat the process for the other cells and rows in the table.
            // We can also speed things up by cloning existing cells and rows.
            row.AppendChild(cell.Clone(false));
            row.LastCell.AppendChild(new Paragraph(doc));
            row.LastCell.FirstParagraph.AppendChild(new Run(doc, "Row 1, Cell 2 Text"));
            dataDir = dataDir + "Table.InsertTableUsingNodes_out.doc";
            // Save the document to disk.
            doc.Save(dataDir);
            // ExEnd:InsertTableDirectly
            Console.WriteLine("\nTable using notes inserted successfully.\nFile saved at " + dataDir);
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:50,代码来源:InsertTableDirectly.cs

示例3: InsertTableUsingNodeConstructors

        public void InsertTableUsingNodeConstructors()
        {
            //ExStart
            //ExFor:Table
            //ExFor:Row
            //ExFor:Row.RowFormat
            //ExFor:RowFormat
            //ExFor:Cell
            //ExFor:Cell.CellFormat
            //ExFor:CellFormat
            //ExFor:CellFormat.Shading
            //ExFor:Cell.FirstParagraph
            //ExId:InsertTableUsingNodeConstructors
            //ExSummary:Shows how to insert a table using the constructors of nodes.
            Document doc = new Document();

            // We start by creating the table object. Note how we must pass the document object
            // to the constructor of each node. This is because every node we create must belong
            // to some document.
            Table table = new Table(doc);
            // Add the table to the document.
            doc.FirstSection.Body.AppendChild(table);

            // Here we could call EnsureMinimum to create the rows and cells for us. This method is used
            // to ensure that the specified node is valid, in this case a valid table should have at least one
            // row and one cell, therefore this method creates them for us.

            // Instead we will handle creating the row and table ourselves. This would be the best way to do this
            // if we were creating a table inside an algorthim for example.
            Row row = new Row(doc);
            row.RowFormat.AllowBreakAcrossPages = true;
            table.AppendChild(row);

            // We can now apply any auto fit settings.
            table.AutoFit(AutoFitBehavior.FixedColumnWidths);

            // Create a cell and add it to the row
            Cell cell = new Cell(doc);
            cell.CellFormat.Shading.BackgroundPatternColor = Color.LightBlue;
            cell.CellFormat.Width = 80;
            
            // Add a paragraph to the cell as well as a new run with some text.
            cell.AppendChild(new Paragraph(doc));
            cell.FirstParagraph.AppendChild(new Run(doc, "Row 1, Cell 1 Text"));

            // Add the cell to the row.
            row.AppendChild(cell);

            // We would then repeat the process for the other cells and rows in the table.
            // We can also speed things up by cloning existing cells and rows.
            row.AppendChild(cell.Clone(false));
            row.LastCell.AppendChild(new Paragraph(doc));
            row.LastCell.FirstParagraph.AppendChild(new Run(doc, "Row 1, Cell 2 Text"));

            doc.Save(MyDir + @"\Artifacts\Table.InsertTableUsingNodes.doc");
            //ExEnd

            Assert.AreEqual(1, doc.GetChildNodes(NodeType.Table, true).Count);
            Assert.AreEqual(1, doc.GetChildNodes(NodeType.Row, true).Count);
            Assert.AreEqual(2, doc.GetChildNodes(NodeType.Cell, true).Count);
            Assert.AreEqual("Row 1, Cell 1 Text\r\nRow 1, Cell 2 Text", doc.FirstSection.Body.Tables[0].ToString(SaveFormat.Text).Trim());
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:62,代码来源:ExTable.cs

示例4: CloneShouldReturnObject

 public void CloneShouldReturnObject()
 {
     var cell = new Cell();
     Assert.IsInstanceOfType(cell.Clone(), typeof(Cell));
 }
开发者ID:HQC-Team-Minesweeper-5,项目名称:Minesweeper,代码行数:5,代码来源:CellTests.cs

示例5: DoSimulationStep

    void DoSimulationStep(Cell[,] map)
    {
        var oldMap = map.Clone() as Cell[,];

        for (int x = 0; x < _MapSize.width; ++x)
        {
            for (int y = 0; y < _MapSize.height; ++y)
            {
                int numOfAliveNeighbor = GetNumberOfAliveNeighbor(oldMap, x, y);

                if (map[x, y].Alive)
                {
                    //살아있는 이웃이 death limit보다 적으면 죽인다.
                    map[x, y].Alive = (numOfAliveNeighbor >= _DeathLimit);
                }
                else
                {
                    //살아있는 이웃이 birth limit보다 많으면 살려낸다.
                    map[x, y].Alive = (numOfAliveNeighbor >= _BirthLimit);
                }
            }
        }
    }
开发者ID:CravemobAidenYang,项目名称:Roguelike,代码行数:23,代码来源:CaveMapGenerator.cs

示例6: FillPlayingFieldWithCells

        /// <summary>
        /// This method fills the playing field matrix with cells.
        /// </summary>
        /// <param name="emptyPlayingField">An empty playing field matrix.</param>
        private void FillPlayingFieldWithCells(Cell[,] emptyPlayingField)
        {
            int rows = emptyPlayingField.GetLength(0);
            int cols = emptyPlayingField.GetLength(1);
            Cell[,] playingField = emptyPlayingField;
            Cell cell = new Cell();

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    playingField[i, j] = cell.Clone() as Cell;
                }
            }
        }
开发者ID:HQC-Team-Minesweeper-5,项目名称:Minesweeper,代码行数:19,代码来源:PlayingField.cs


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