win form 下, context menu的定位。
private void gvList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { DataGridView.HitTestInfo hitTestInfo = gvList.HitTest(e.X, e.Y); Point pt = gvList.PointToClient(Control.MousePosition); //if (hitTestInfo.Type == DataGridViewHitTestType.Cell) ctxGvList.Show(gvList, pt); } }