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


C# Canvas.GetInnerCanvas方法代码示例

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


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

示例1: Test_Canvas_GetInnerCanvasException

        public void Test_Canvas_GetInnerCanvasException()
        {
            Canvas canvas = new Canvas(new Resolution(10, 8));
            #region Filling canvas
            for (int y = 0; y < 8; y++)
                for (int x = 0; x < 10; x++)
                {
                    if (x == 5 && y == 2) canvas.SetColor(x, y, Color.Red);
                    else canvas.SetColor(x, y, Color.Black);
                }
            #endregion

            Canvas actual = canvas.GetInnerCanvas(5, 2, new Resolution(10, 4));
        }
开发者ID:nsvova,项目名称:Embroidery-NS-Vova,代码行数:14,代码来源:UnitCanvas.cs

示例2: Test_Canvas_GetInnerCanvas

        public void Test_Canvas_GetInnerCanvas()
        {
            Canvas canvas = new Canvas(new Resolution(10, 8));
            #region Filling canvas
            for(int y = 0; y < 8; y++)
                for (int x = 0; x < 10; x++)
                {
                    if (x == 5 && y == 2) canvas.SetColor(x, y, Color.Red);
                    else canvas.SetColor(x, y, Color.Black);
                }
            #endregion

            Canvas expectedCanvas = new Canvas(new Resolution(3, 4));
            #region Filling canvas
            for (int y = 0; y < 4; y++)
                for (int x = 0; x < 3; x++)
                {
                    if (x == 0 && y == 0) expectedCanvas.SetColor(x, y, Color.Red);
                    else expectedCanvas.SetColor(x, y, Color.Black);
                }
            #endregion

            Canvas actual = canvas.GetInnerCanvas(5, 2, new Resolution(3, 4));

            Assert.IsTrue(actual.Width == expectedCanvas.Width && actual.Height == expectedCanvas.Height);

            for (int y = 0; y < actual.Height; y++)
                for (int x = 0; x < actual.Width; x++)
                    Assert.IsTrue(actual.GetColor(x, y) == expectedCanvas.GetColor(x, y));
        }
开发者ID:nsvova,项目名称:Embroidery-NS-Vova,代码行数:30,代码来源:UnitCanvas.cs


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