グリッド行を右クリックすると、それに割り当てられたコンテキスト メニュー ストリップが数秒間表示され、フォームのコンテキスト メニューに置き換えられます。クリックがグリッド上にある場合、グリッドのコンテキスト メニュー ストリップが表示されたままになるようにするにはどうすればよいですか。
コード:
private void Form1_Load(object sender, EventArgs e)
{
Matches();
DataTable dt = new DataTable();
dt.Columns.Add("Test", typeof(string));
dt.Rows.Add("A");
dt.Rows.Add("A");
dt.Rows.Add("A");
dt.Rows.Add("A");
dt.Rows.Add("A");
dt.Rows.Add("A");
ContextMenuStrip ctsForm = new ContextMenuStrip();
ctsForm.Items.Add("Form");
ctsForm.Opening+=ctsForm_Opening;
ctsGrid.Items.Add("Grid");
gridControl1.DataSource = dt;
gridView1.PopupMenuShowing+=gridView1_PopupMenuShowing;
this.ContextMenuStrip = ctsForm;
}
private void ctsForm_Opening(object sender, CancelEventArgs e)
{
}
private void gridView1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
{
GridView view = (GridView)sender;
GridHitInfo hitInfo = view.CalcHitInfo(e.Point);
if (hitInfo.InRow)
{
view.FocusedRowHandle = hitInfo.RowHandle;
ctsGrid.Show(view.GridControl, e.Point);
}
}