これが可能かどうかはわかりませんが、DataGridViewセル内にあるボタンのインスタンスを取得したいと思います。(c#.netおよびWindowsフォームの操作)
これは、ボタンの近くにコントロールがあるパネルをポップアップしたいので、その場所が必要だからです。(これは可能ですか?)
CellClickedイベントハンドラーでボタンのクリックを処理しています。
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
Int32 id = (Int32)dataGridView1[0, e.RowIndex].Value;
if (e.RowIndex < 0 || e.ColumnIndex != dataGridView1.Columns["NewDate"].Index)
{
if (e.RowIndex < 0 || e.ColumnIndex != dataGridView1.Columns["Delete"].Index) return;
else
{
}
}
else
{
//Button button - the button I'm trying to get
panel2.Location=new Point(button.Location.X,button.Location.Y);
}
}