Пример #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public UCPageGridControl()
        {
            InitializeComponent();

            this._dataGridView            = this.CreateDataGridView();
            this._fPageGridColumnsSetting = this.CreateColSetting();

            this.panelContent.Controls.Add(this._dataGridView);
            this.panelContent.Controls.Add(this._fPageGridColumnsSetting);

            this._dataGridView.SelectionChanged += GridView_SelectionChanged;
            this._dataGridView.MouseClick       += GridView_MouseClick;
            this._dataGridView.MouseDoubleClick += GridView_MouseDoubleClick;

            this.SetPageInfo(null);

            var pageControls = new List <Control>();

            foreach (Control control in panelPage.Controls)
            {
                pageControls.Add(control);
            }

            this._pageControls = new ReadOnlyCollection <Control>(pageControls);
            //初始化列设置存放目录
            this._settingDirectory          = PageGridControlCommon.GetDefaultSettingDirectory();
            this.numPageIndex.ValueChanged += this.numPageIndex_ValueChanged;
            this.EnableRowNum = true;
            this.EnableColumnHeaderContextMenuStripHiden = true;
        }
Пример #2
0
        private string GetColSettingFilePath()
        {
            if (string.IsNullOrEmpty(this._dataSourceName) ||
                string.IsNullOrEmpty(this._settingDirectory) ||
                this._dataGridView.Columns.Count == 0)
            {
                return(null);
            }

            return(PageGridControlCommon.GetGridColumnSettingFilePath(this._settingDirectory, this._dataSourceName));
        }
Пример #3
0
        /// <summary>
        /// 列可见性改变通知处理方法
        /// </summary>
        /// <param name="columnName">DataGridViewColumn</param>
        /// <param name="visible"></param>
        private void ColumnVisibleChangedNotify(string columnName, bool visible)
        {
            if (this._dataGridView.Columns.Count < 1)
            {
                return;
            }

            DataGridViewColumn targetCol = null;

            foreach (DataGridViewColumn col in this._dataGridView.Columns)
            {
                if (PageGridControlCommon.CompareColumnName(col.Name, columnName))
                {
                    col.Visible = visible;
                    targetCol   = col;
                    break;
                }
            }

            this.SetLastDataGridViewColumnAutoSizeModeFill(targetCol);
            //this.SetLastDataGridViewColumnAutoSizeModeFill2();
        }
Пример #4
0
        internal void HidenColumn(string hidenColumnName)
        {
            var hidenColumnSettingInfo = this._columnSettingInfoList.Where(t => { return(PageGridControlCommon.CompareColumnName(t.ColumnName, hidenColumnName)); }).FirstOrDefault();

            if (hidenColumnSettingInfo != null)
            {
                hidenColumnSettingInfo.Visible = false;
            }
        }