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);
            }
        }

  

posted @ 2011-12-18 19:55  无尽思绪  阅读(231)  评论(0编辑  收藏  举报