コード例 #1
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            // перезагрузка таблицы
            DataTable newDataTable = new DataTable();

            if (LoadDataTable(baseAdapter, errLog, ref newDataTable))
            {
                dataTable = newDataTable;
                try { dataTable.DefaultView.RowFilter = txtFilter.Text; }
                catch { txtFilter.Text = ""; }
                bindingSource.DataSource = dataTable;
                ScadaUiUtils.AutoResizeColumns(dataGridView);
            }
        }
コード例 #2
0
        private void FrmBaseTableView_Load(object sender, EventArgs e)
        {
            // перевод формы
            Translator.TranslateForm(this, "Scada.Server.Ctrl.FrmBaseTableView");
            if (lblCount.Text.Contains("{0}"))
            {
                bindingNavigator.CountItemFormat = lblCount.Text;
            }

            // настройка элементов управления
            string tableTitle = BaseTableTitles.TryGetValue(baseAdapter.TableName, out tableTitle) ?
                                " - " + tableTitle : "";

            Text += " - " + baseAdapter.TableName + tableTitle;
            dataGridView.AutoGenerateColumns = true;
            bindingSource.DataSource         = dataTable;
            ScadaUiUtils.AutoResizeColumns(dataGridView);
        }
コード例 #3
0
        private void FrmObj_Shown(object sender, EventArgs e)
        {
            if (Table == null)
            {
                bindingNavigatorUpdateItem.Enabled     = false;
                bindingNavigatorCancelItem.Enabled     = false;
                bindingNavigatorRefreshItem.Enabled    = false;
                bindingNavigatorDeleteItem.Enabled     = false;
                bindingNavigatorClearItem.Enabled      = false;
                bindingNavigatorAutoResizeItem.Enabled = false;
            }
            else
            {
                Table.RowChanged += dataTable_RowChanged;
                Table.RowDeleted += dataTable_RowDeleted;

                string tableName = Table.TableName;
                if (tableName == "User")
                {
                    pwdColExists = true;
                }
                else if (tableName == "EvType")
                {
                    clrColExists = true;
                }
                else if (tableName == "Formula")
                {
                    srcColExists = true;
                }
                else if (tableName == "InCnl" || tableName == "CtrlCnl")
                {
                    modDTColExists = true;
                }

                bindingSource.DataSource = Table;
                dataGridView.Columns.AddRange(Table.ExtendedProperties["Columns"] as DataGridViewColumn[]);
                ScadaUiUtils.AutoResizeColumns(dataGridView);

                SetModified(false);
            }
        }
コード例 #4
0
 private void bindingNavigatorAutoResizeItem_Click(object sender, EventArgs e)
 {
     ScadaUiUtils.AutoResizeColumns(dataGridView);
 }