2

我在 GridControl 上有一个 MouseDown 事件,它确定用户单击了哪一行:

    private void genericView_MouseDown(object sender, MouseEventArgs e)
    {
        var hitInfo = vw.CalcHitInfo(new Point(e.X, e.Y));
        //do other things with the hitInfo object
    }

这段代码就像我期望的那样工作。

但是,此代码不

    private void genericView_MouseDown(object sender, MouseEventArgs e)
    {
        var hitInfo = vw.CalcHitInfo(new Point(MousePosition.X, MousePosition.Y));
        //do other things with the hitInfo object
    }

它编译,但返回不准确的数据。

我认为 MouseEventArgs 和 MousePosition 将是相同的坐标,但我猜不是。有什么不同?

4

1 回答 1

3

e.Xe.Y是相对于控件,而MousePosition是相对于Screen.Bounds.

于 2013-11-06T18:53:54.720 回答