日期:2014-05-17  浏览次数:20966 次

窗体中重写事件方法和窗体自带的事件的区别?
重写:
protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.X < ClientSize.Width / 2)
                if (e.Y < ClientSize.Height / 2)
                    this.Cursor = Cursors.Hand;                 //鼠标为手形图标
                else
                    this.Cursor = Cursors.Help;                 //鼠标为帮助图标
            else
                if (e.Y < ClientSize.Height / 2)
                    this.Cursor = Cursors.WaitCursor;           //鼠标为等待图标
                else
                    this.Cursor = Cursors.Cross;                //鼠标为十字图标
        }
运行能变换鼠标的图标
我写在窗体自带的事件中,不能变换图标
private void FormMouseRegion_MouseMove(object sender, MouseEventArgs e)
{
    if (e.X < ClientSize.Width / 2)
        if (e.Y < ClientSize.Height / 2)
            this.Cursor = Cursors.Hand;                 //鼠标为手形图标
        else
            this.Cursor = Cursors.Help;                 //鼠标为帮助图标
    else
        if (e.Y < ClientSize.Height / 2)
            this.Cursor = Cursors.WaitCursor;           //鼠标为等待图标
        else
            this.Cursor = Cursors.Cross;                //鼠标为十字图标
}
    }
为什么??