zoukankan      html  css  js  c++  java
  • C#下移动无边框窗体(直接粘贴可用)

            #region //移动无边框窗体

            private bool _frmBeginMove = false;
            Point _frmLocation = new Point();
            protected override void OnMouseMove(MouseEventArgs e)
            {
                if (_frmBeginMove)
                {
                    Point p = this.PointToScreen(e.Location );
                    p.Offset(-_frmLocation.X,-_frmLocation.Y );
                    this.Location =p;
                }
                base.OnMouseMove(e);
            }
            protected override void OnMouseDown(MouseEventArgs e)
            {
                this._frmBeginMove = true;
                _frmLocation = e.Location;
                base.OnMouseDown(e);
            }
            protected override void OnMouseUp(MouseEventArgs e)
            {
                this._frmBeginMove = false;
                base.OnMouseUp(e);
            }
            protected override void OnMouseLeave(EventArgs e)
            {
                _frmLocation = new Point();
                this._frmBeginMove = false;
                base.OnMouseLeave(e);
            }
            #endregion

  • 相关阅读:
    圣杯布局(定宽与自适应)
    【转载】jQuery插件开发精品教程,让你的jQuery提升一个台阶
    DOM 事件深入浅出(一)
    匿名类型
    类和结构
    C#预处理器指令
    Main()方法
    枚举
    预定义数据类型
    C#语言
  • 原文地址:https://www.cnblogs.com/teyond/p/2442123.html
Copyright © 2011-2022 走看看