zoukankan      html  css  js  c++  java
  • 手机滑动解锁代码

      #region==滑动解锁部分==
            private bool mousedown;//定义鼠标点击的bool值
            private int curx;//定义鼠标点击时的位置X坐标
    
            private void button11_MouseDown(object sender, MouseEventArgs e)
            {
                mousedown = true;
                curx = Cursor.Position.X;//获取点击时的X坐标
            }
    
            private void button11_MouseUp(object sender, MouseEventArgs e)//判断移动的程度是否达到要求
            {
                mousedown = false;
                if (Cursor.Position.X - curx > 100)
                {
                    panel3.Visible = false;
    
                }
                else
                {
                    button11.Location = new Point(12,341);
                }
            }
    
            private void button11_MouseMove(object sender, MouseEventArgs e)
            {
                if (mousedown)
                {
                    button11.Location = new Point(12+Cursor.Position.X-curx,341);
                }
            }
    
           
            #endregion
            private void panel2_MouseDown(object sender, MouseEventArgs e)
            {
                mousedown = true;
                curx = Cursor.Position.X;
            }
    
            private void panel2_MouseUp(object sender, MouseEventArgs e)
            {
    
                if (Cursor.Position.X - curx < -50)
                {
                    panel2.Location = new Point(-286, 0);
                    panel4.Location = new Point(0, 0);
                }
                else
                {
                    panel2.Location = new Point(0, 0);
                    panel4.Location = new Point(286, 0);
                }
                mousedown = false;
               
            }
    
            private void panel2_MouseMove(object sender, MouseEventArgs e)
            {
                if (mousedown)
                {
                    panel2.Location = new Point(0+Cursor.Position.X-curx,0);
                    panel4.Location = new Point(286 + Cursor.Position.X - curx, 0);
                }
            }
    
            private void panel4_MouseDown(object sender, MouseEventArgs e)
            {
                mousedown = true;
                curx = Cursor.Position.X;
            }
    
            private void panel4_MouseUp(object sender, MouseEventArgs e)
            {
                if (Cursor.Position.X - curx >50)
                {
                    panel2.Location = new Point(0, 0);
                    panel4.Location = new Point(289, 0);
                }
                else
                {
                    panel2.Location = new Point(-286, 0);
                    panel4.Location = new Point(0, 0);
                }
                mousedown = false;
            }
    
            private void panel4_MouseMove(object sender, MouseEventArgs e)
            {
                if (mousedown)
                {
                    panel2.Location = new Point(-286+ Cursor.Position.X - curx, 0);
                    panel4.Location = new Point(0 + Cursor.Position.X - curx, 0);
                }
            }
    
          
  • 相关阅读:
    使用shell数据处理数据实例①-------手把手教学版
    python requests模块中返回时间elapsed解析
    一个简单web系统的接口性能分析及调优过程
    mock server搭建及接口测试简单实例
    linux下jmeter持续集成Jenkins部署时问题解决
    jmeter函数助手之time函数实操
    jmeter聚合报告导出时乱码的解决
    C++ Windows API 读写INI文件
    VC++运行库 集32位/64位整合版
    Installshield2015 定制安装在C:Program files 目录 不正确问题
  • 原文地址:https://www.cnblogs.com/wei270647220/p/4399857.html
Copyright © 2011-2022 走看看