Exemplo n.º 1
0
        public void GridDraw(Graphics g)
        {
            Pen   p      = new Pen(Color.Black);
            int   yMod   = ss.getCanvasHeight();
            int   xMod   = ss.getCanvasWidth();
            int   width  = ss.getGridWitdh();
            int   zoom   = (int)ss.getDrawScale();
            float factor = (ss.getDrawScale());


            if (width > 0)
            {
                for (int y = 0; y < (int)(yMod * factor); y += (int)(width * factor))
                {
                    g.DrawLine(p, 0, y, (int)(yMod * factor), y);
                }
                for (int x = 0; x < (int)(xMod * factor); x += (int)(width * factor))
                {
                    g.DrawLine(p, x, 0, x, (int)(xMod * factor));
                }
            }
            else if (width == -1)
            {
                if (zoom >= 15)
                {
                    for (int y = 0; y < yMod; y += zoom)
                    {
                        g.DrawLine(p, 0, y, yMod, y);
                    }
                    for (int x = 0; x < xMod; x += zoom)
                    {
                        g.DrawLine(p, x, 0, x, xMod);
                    }
                }
                else if (zoom < 15 && zoom > 10)
                {
                    //TODO
                }
            }
        }