protected void PaintGrid(int width, int height)
 {
     if (XTics != null && VerticalGrid != GridType.None)
     {
         Color      c    = VerticalGridColor;
         double[][] tics = XTics;
         foreach (double a in tics[0])
         {
             int b = ModelToViewX(a, width);
             backBuffer.DrawLine(c, b, 0, b, height - 1, true, VerticalGridWidth);
         }
         if (VerticalGrid == GridType.All)
         {
             foreach (double a in tics[1])
             {
                 int b = ModelToViewX(a, width);
                 backBuffer.DrawLine(c, b, 0, b, height - 1, true, VerticalGridWidth);
             }
         }
     }
     if (YTics != null && HorizontalGrid != GridType.None)
     {
         Color      c    = HorizontalGridColor;
         double[][] tics = YTics;
         foreach (double a in tics[0])
         {
             int b = ModelToViewY(a, height);
             backBuffer.DrawLine(c, 0, b, width - 1, b, true, HorizontalGridWidth);
         }
         if (HorizontalGrid == GridType.All)
         {
             foreach (double a in tics[1])
             {
                 int b = ModelToViewY(a, height);
                 backBuffer.DrawLine(c, 0, b, width - 1, b, true, HorizontalGridWidth);
             }
         }
     }
     if (HorizontalZeroVisible)
     {
         Color c = HorizontalZeroColor;
         int   b = ModelToViewY(0, height);
         backBuffer.DrawLine(c, 0, b, width - 1, b, false, HorizontalZeroWidth);
     }
     if (VerticalZeroVisible)
     {
         Color c = VerticalZeroColor;
         int   b = ModelToViewX(0, width);
         backBuffer.DrawLine(c, b, 0, b, height - 1, false, VerticalZeroWidth);
     }
 }