private void myDataGrid1_CurrentCellChanged(object sender, System.EventArgs e) { try { int nrow = this.myDataGrid1.CurrentCell.RowNumber; int ncol = this.myDataGrid1.CurrentCell.ColumnNumber; string columnName = this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol].HeaderText.Trim(); this.cmbyplx.Visible = false; this.cmbjxdl.Visible = false; if (columnName.Trim() == "统领分类") { DataTable tb = (DataTable)this.myDataGrid1.DataSource; if (nrow > tb.Rows.Count - 1) { return; } this.cmbyplx.Visible = true; this.cmbyplx.Left = this.myDataGrid1.GetCellBounds(nrow, ncol).Left + this.myDataGrid1.Left; this.cmbyplx.Top = this.myDataGrid1.GetCellBounds(nrow, ncol).Top + this.myDataGrid1.Top; this.cmbyplx.Width = this.myDataGrid1.GetCellBounds(nrow, ncol).Width; string tlfl = Convertor.IsNull(tb.Rows[nrow]["tlfl"], "0"); cmbyplx.Text = Yp.SeekTlfl(tlfl, InstanceForm.BDatabase); cmbyplx.Focus(); return; } if (columnName.Trim() == "剂型大类") { DataTable tb = (DataTable)this.myDataGrid1.DataSource; if (nrow > tb.Rows.Count - 1) { return; } this.cmbjxdl.Visible = true; this.cmbjxdl.Left = this.myDataGrid1.GetCellBounds(nrow, ncol).Left + this.myDataGrid1.Left; this.cmbjxdl.Top = this.myDataGrid1.GetCellBounds(nrow, ncol).Top + this.myDataGrid1.Top; this.cmbjxdl.Width = this.myDataGrid1.GetCellBounds(nrow, ncol).Width; string jxdl = Convertor.IsNull(tb.Rows[nrow]["jxdl"], "0"); cmbjxdl.Text = Convertor.IsNull(InstanceForm.BDatabase.GetDataResult("select jxmc from YP_YPJXDL where jxbm='" + jxdl + "'"), ""); cmbjxdl.Focus(); return; } } catch (System.Exception err) { MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }