public void clear()
 {
     try
     {
         if (gr != null)
         {
             gr.Clear(Color.White);
         }
         else
         {
             target.DBpanelgr.CreateDoubleBuffer(target.CreateGraphics(), target.ClientRectangle.Width, target.ClientRectangle.Height);
             gr = target.DBpanelgr.g;
             if (gr != null)
             {
                 gr.Clear(Color.White);
             }
         }
     } catch (Exception ex) { }
 }
        public GridDrawer(DPanel dp)
        {
            target = dp;
            target.DBpanelgr.CreateDoubleBuffer(target.CreateGraphics(), target.ClientRectangle.Width, target.ClientRectangle.Height);

            gr  = target.DBpanelgr.g;
            pen = new Pen(Color.Black);
            Font font = new Font(new FontFamily("Arial"), 8);

            gridW = Environment.envW;
            gridH = Environment.envH;

            cellW = (float)target.ClientRectangle.Width / gridW;
            cellH = (float)target.ClientRectangle.Height / gridH;

            Utils.imgW = (int)(cellW - 1);
            Utils.imgH = (int)(cellH - 1);
        }
        public GridDrawer(DPanel dp)
        {
            target = dp;
            target.DBpanelgr.CreateDoubleBuffer(target.CreateGraphics(), target.ClientRectangle.Width, target.ClientRectangle.Height);

            gr = target.DBpanelgr.g;
            pen = new Pen(Color.Black);
            Font font = new Font(new FontFamily("Arial"), 8);

            gridW = Environment.envW;
            gridH = Environment.envH;

            cellW = (float)target.ClientRectangle.Width / gridW;
            cellH = (float)target.ClientRectangle.Height / gridH;

            Utils.imgW = (int)(cellW - 1);
            Utils.imgH = (int)(cellH - 1);
        }