Answer the question
In order to leave comments, you need to log in
Handle click event on DGV header?
Good afternoon. I'm using the RowHeaderMouseClick event to call the context menu in the DGV. But when you click on this area of the selected area , the event does not occur. In general, it is clear why. The question is, what event to process when clicking on this area?
Answer the question
In order to leave comments, you need to log in
Handle the generic CellMouseClick event . The cell selected in the screenshot has both indices equal to -1:
private void DataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
var row = e.RowIndex;
var column = e.ColumnIndex;
if(row == -1 && column == -1)
{
// Do something
}
}
In theory, this is the header area of the table grid. Have you tried DataGridView.ColumnHeaderMouseClick?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question