从其他课程获取鼠标坐标

时间:2018-02-12 15:22:45

标签: c# class

我有一个A和B类,A类获得由B类的Mouse_Move事件产生的点坐标,但是当我开始在Panel中移动鼠标时返回0。有什么问题,我真的很困惑?:

        public class A
    {
        public A()
        {
        }
        private Point Point_;
        public Point MOUSEPOINT
        {
            get { return Point_; }
            set { this.Point_ = value; }
        }
    }
    public class B:A
    {
        public B(Panel panel)
        {
            panel.MouseMove += Panel_MouseMove;
        }

        private void Panel_MouseMove(object sender, MouseEventArgs e)
        {
            MOUSEPOINT = new Point(e.X, e.Y);
        }
    }

希望得到你的帮助

0 个答案:

没有答案