C#windows窗体呈现等距瓷砖

时间:2016-11-01 11:13:04

标签: c# opengl

我知道基于这个主题已经提出了很多问题,但仍然无法在等轴测视图中生成图块。

请检查以下代码及其输出

  private void picIsometricBox_Paint(object sender, PaintEventArgs e)
    {
        try
        { 
            int paddingTop = sdpaddingTop.Value * -80;
            int paddingleft = sdpaddingLeft.Value * 40;
            int rotateangle = sbRotate.Value * 5;
            int noofCells = 9;
            int cellsize = 60;
            int x = 0; 
            for (int j = 1; j <= noofCells; j++)
            {
                for (int i = 1; i <= noofCells; i++)
                {
                    var ep = (x % 2) == 0 ? Brushes.White : Brushes.Black;
                    int xv = (j * cellsize + paddingleft);
                    int yv = (i * cellsize) + paddingTop;
                    int xxv = (i * cellsize) + paddingleft;
                    int yyv = cellsize + paddingTop;
                    e.Graphics.RotateTransform(rotateangle);
                    e.Graphics.FillRectangle(ep, xv, yv, cellsize, cellsize);
                    e.Graphics.FillRectangle(ep, xxv, yyv, cellsize, cellsize);
                    e.Graphics.ResetTransform(); 
                    x++; 
                }
            } 
        }
        catch (Exception ex)
        {         
        }          
    }

输出在图片框中呈现:

out put1

我不知道如何生成如下所示的瓷砖

out put2

0 个答案:

没有答案