dataGridView1_SelectionChanged事件触发。我只使用一个网格。
private void mgInvoice_SelectionChanged(object sender, EventArgs e)
{
if (this.IsFlagForShowImage)
{
////If show image flag is true then only show images for invoices.
try
{
if (this.mgInvoice.SelectedRows != null)
{
if (this.mgInvoice.SelectedRows.Count > 0)
{
invoice = this.mgInvoice.SelectedRows[0].DataBoundItem as TAPInvoice;
Thread th = new Thread(new ThreadStart(LoadDocumentIdByInvoice));
th.Start();
this.ShowInvoiceImageDocumentByDocId(this.invoice);
IsModifiedCollection = true;
//Zahid
this.SetPriviliges();
}
}
}
catch
{
throw;
}
finally
{
}
}
}
上述事件正确触发。但是下面提到的事件不会发生。
private void mgInvoice_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (this.mgInvoice.Columns["FImagesReviewed"].Visible)
{
this.mgInvoice.Columns["FImagesReviewed"].Visible = true;
}
else if (this.mgInvoice.Columns["FImagesApproved"].Visible)
{
this.mgInvoice.Columns["FImagesApproved"].Visible = true;
}
}
答案 0 :(得分:0)
我遇到了同样的问题。在SelectionChanged事件处理程序中对DataGridView的CurrentCell进行了赋值:
_DataGridView.CurrentCell = cellToSelect;
删除此分配后,CellClick事件再次被触发。