WinFrom中实现点击关闭按钮窗口在靠屏幕左边中间缓缓收缩

来源:互联网 发布:js 获取元素父节点 编辑:程序博客网 时间:2024/05/02 06:10
        private void btn_close_Click(object sender, EventArgs e)        {            timer_close.Start();        }        int _X = 0;        int _Y = 0;        private void timer_close_Tick(object sender, EventArgs e)        {            //渐渐的关闭            _X = this.Location.X;            _Y = this.Location.Y;            _X -= 5;            this.Location = new Point(_X, _Y);            if (_X <= -900)            {                this.timer_close.Enabled = false;                this.Close();            }        }

Timer 空间的Interval数值是走动的速度