Beispiel #1
0
        private void LoadDataGrid(Janus.Windows.GridEX.GridEX dgv, DBInfoList dBInfoList)
        {
            dgv.DataSource = dBInfoList;
            //dgv.AutoSizeColumns();
            string path = Form_QD.__documentDirectory + "\\Layout\\" + dgv.SettingsKey + ".gxl";

            if (File.Exists(path))
            {
                FileStream fs = new FileStream(path, FileMode.Open);
                try { dgv.LoadLayoutFile(fs); }
                catch { fs.Close(); File.Delete(path); }
                fs.Close();
            }
        }
        /*private void chVisualizacion_CheckedChanged(object sender, EventArgs e)
         * {
         *      bGuardar.Enabled = chVisualizacion.Checked;
         *      bReestablecer.Enabled = chVisualizacion.Checked;
         *      if( _gridSource != null)
         *      {
         *              if (chVisualizacion.Checked)
         *              {
         *                      if (System.IO.File.Exists(_uiController.Path) )
         *                      {
         *                              System.IO.StreamReader str = new System.IO.StreamReader(_uiController.Path);
         *                              _gridSource.LoadLayoutFile(str.BaseStream);
         *                              str.Close();
         *                              _loadFromFile = true;
         *                      }
         *              }
         *              else
         *              {
         *                      _gridSource.LayoutData = _layoutDefault;
         *                      _loadFromFile = false;
         *              }
         *      }
         * }*/
        #endregion

        #region metodos publicos

        public void LoadLayout()
        {
            if (_gridSource != null)
            {
                if (System.IO.File.Exists(_uiController.Path))
                {
                    System.IO.StreamReader str = new System.IO.StreamReader(_uiController.Path);
                    _gridSource.LoadLayoutFile(str.BaseStream);
                    str.Close();
                    _loadFromFile = true;
                }
                else
                {
                    _gridSource.LayoutData = _layoutDefault;
                    _loadFromFile          = false;
                }
            }
        }