• Winform窗体拖动


    private void panelControl1_MouseDown(object sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left)
                {
                    currentFormWidth = this.Width;
                    currentFormWidth = this.Height;
                    isMouseDown = true;
                    mouseOffset = new Point(MousePosition.X - this.Location.X, MousePosition.Y - this.Location.Y);
                    this.Cursor = Cursors.SizeAll;
                }
            }
    
            private void panelControl1_MouseEnter(object sender, EventArgs e)
            {
                isMouseEnter = true;
            }
    
            private void panelControl1_MouseLeave(object sender, EventArgs e)
            {
                Point p = MousePosition;
                if (p.X - 10 <= this.Left || p.X + 10 >= this.Left + currentFormWidth || p.Y - 10 <= this.Top || p.Y + 10 >= this.Bottom)
                {
                    isMouseEnter = false;
                }
            }
    
            private void panelControl1_MouseMove(object sender, MouseEventArgs e)
            {
                if (isMouseDown == true)
                {
                    Point old = this.Location;
                    this.Location = getMiniBallMoveLocation();
                }
            }
    
            private void panelControl1_MouseUp(object sender, MouseEventArgs e)
            {
                isMouseDown = false;
                this.Cursor = Cursors.Default;
            }
    
            private Point getMiniBallMoveLocation()
            {
                int x = MousePosition.X - mouseOffset.X;
                int y = MousePosition.Y - mouseOffset.Y;
                return new Point(x, y);
            }
  • 相关阅读:
    Dubbo基础知识
    mongodb 备份还原
    如何快速同步hdfs数据到ck
    sed 删除命令
    Host key verification failed 问题解决
    es boolquery 的几种用法
    ck中如何查询同比环比
    mysql 触发器介绍
    clickhouse 批量删除分区
    kafka 数据清除机制
  • 原文地址:https://www.cnblogs.com/Xamarin-Oz/p/11254386.html
Copyright © 2020-2023  润新知