Example #1
0
        private async void dgModel_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex <= 0)
            {
                return;
            }

            if (e.ColumnIndex <= 2)
            {
                var source     = dgModel.Rows[e.RowIndex].DataBoundItem as HWCfgModel;
                var modulelist = await AccessDBHelper.HWCfgModuleListByInstrumentName(source.HWName, source.InstrumentName, source.ModelName);

                dgModule.DataSource = modulelist;
            }

            if (dgModel.Columns[e.ColumnIndex].DataPropertyName == "Active")
            {
                var rect = dgModel.GetCellDisplayRectangle(dgModel.CurrentCell.ColumnIndex, dgModel.CurrentCell.RowIndex, false);
                cmbActive.Left    = rect.Left;
                cmbActive.Top     = rect.Top;
                cmbActive.Width   = rect.Width;
                cmbActive.Height  = rect.Height;
                cmbActive.Visible = true;
                cmbActive.Focus();
                dgModel.CurrentCell.Style.SelectionBackColor = Color.White;
                var sexValue = dgModel.CurrentCell.Value.ToString();
                cmbActive.Text = Util.GetActiveValToBoolDisplay(sexValue);
            }
        }