コード例 #1
0
        /// <summary>
        /// initialize internal data before control is shown
        /// </summary>
        public void InitializeData()
        {
            // set fixed column widths as otherwise grid will spend a long time recalculating optimal width with big extracts
            grdDetails.Columns.Clear();
            grdDetails.AddTextColumn("Partner Key", FMainDS.MExtract.Columns[ExtractTDSMExtractTable.GetPartnerKeyDBName()], 100);
            grdDetails.AddTextColumn("Class", FMainDS.MExtract.Columns[ExtractTDSMExtractTable.GetPartnerClassDBName()], 100);
            grdDetails.AddTextColumn("Partner Name", FMainDS.MExtract.Columns[ExtractTDSMExtractTable.GetPartnerShortNameDBName()], 300);
            grdDetails.AddTextColumn("Location Key", FMainDS.MExtract.Columns[ExtractTDSMExtractTable.GetLocationKeyDBName()], 100);

            LoadData();

            // get the grid columns to fill the available space
            grdDetails.AutoStretchColumnsToFitWidth = true;
            grdDetails.Columns[2].AutoSizeMode      = SourceGrid.AutoSizeMode.EnableStretch | SourceGrid.AutoSizeMode.EnableAutoSize;
            grdDetails.Rows.AutoSizeMode            = SourceGrid.AutoSizeMode.None;

            // allow multiselection of list items so several records can be deleted at once
            grdDetails.Selection.EnableMultiSelection = true;

            // initialize button state
            if (grdDetails.Rows.Count > 1)
            {
                grdDetails.SelectRowInGrid(1);
                ShowDetails(1);

                UpdateRecordNumberDisplay();
            }
            else
            {
                btnEdit.Enabled = false;
            }
        }