• Winform 鼠标拖动窗体


    窗体移动
    private Point mouseOffset;
            
    private bool isMouseDown = false;

            
    private void Form1_MouseDown(object sender, MouseEventArgs e)
            {
                
    int yOffset, xOffset;
                
    if(e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    xOffset 
    = -e.X - SystemInformation.FrameBorderSize.Width;
                    yOffset 
    = -e.Y - SystemInformation.FrameBorderSize.Height;
                    mouseOffset 
    = new Point(xOffset, yOffset);
                    isMouseDown 
    = true;
                }
            }

            
    private void Form1_MouseUp(object sender, MouseEventArgs e)
            {
                
    if(e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    isMouseDown 
    = false;
                }
            }

            
    private void Form1_MouseMove(object sender, MouseEventArgs e)
            {
                
    if(isMouseDown)
                {
                    Point p 
    = Control.MousePosition;
                    p.Offset(mouseOffset.X, mouseOffset.Y);
                    Location 
    = p;
                }
            }
  • 相关阅读:
    Gated Recurrent Unit (GRU)
    Long Short-Term Memory (LSTM)
    GBDT && XGBOOST
    记录一次网站打开卡--排故障过程
    linux下mysql5.5 5.6 5.7安装教程
    tomcat无法正常shutdown
    linux服务器被入侵的解决方法
    线上CPU 占用300%多-故障解决
    6流程控制-while
    7 流程控制-for序列 for字典
  • 原文地址:https://www.cnblogs.com/pato/p/1966716.html
Copyright © 2020-2023  润新知