Хорошо. Вот пример с событием щелчка ячейки gridview. Вы можете добавить событие двойного щелчка ячейки с $DataGrid1.Add_CellMouseClick({gridClick})
надеюсь, это поможет
$form = New-Object System.Windows.Forms.Form
$form.Size = New-Object System.Drawing.Size(900,600)
$DataGrid1 = New-Object System.Windows.Forms.DataGridView
$DataGrid1.Size=New-Object System.Drawing.Size(800,400)
$DataGrid1.Add_CellMouseClick({gridClick})
$form.Controls.Add($DataGrid1)
#Create an unbound DataGridView by declaring a column count.
$DataGrid1.ColumnCount = 4
$DataGrid1.ColumnHeadersVisible = $true
#Set the column header names.
$DataGrid1.Columns[0].Name = "Recipe"
$DataGrid1.Columns[1].Name = "Category"
$DataGrid1.Columns[2].Name = "Third COlumn"
$DataGrid1.Columns[3].Name = "Rating"
#Populate the rows.
$row1 = @("Meatloaf","Main Dish", "boringMeatloaf", "boringMeatloafRanking")
$row2 = @("Key Lime Pie","Dessert", "lime juice evaporated milk", "****")
$row3 = @("Orange-Salsa Pork Chops","Main Dish", "pork chops, salsa, orange juice", "****")
$row4 = @("Black Bean and Rice Salad","Salad", "black beans, brown rice", "****")
$row5 = @("Chocolate Cheesecake","Dessert", "cream cheese", "***")
$row6 = @("Black Bean Dip", "Appetizer","black beans, sour cream", "***")
$rows = @( $row1, $row2, $row3, $row4, $row5, $row6 )
foreach ($row in $rows){
$DataGrid1.Rows.Add($row)
}
function gridClick(){
$rowIndex = $DataGrid1.CurrentRow.Index
$columnIndex = $DataGrid1.CurrentCell.ColumnIndex
Write-Host $rowIndex
Write-Host $columnIndex
Write-Host $DataGrid1.Rows[$rowIndex].Cells[0].value
Write-Host $DataGrid1.Rows[$rowIndex].Cells[$columnIndex].value}
$form.ShowDialog()