zoukankan      html  css  js  c++  java
  • BUTTON在界面上位置的移动

    private Point mousePos;  //mouse_位置_記録
    private bool beginmove=false;    //移動_かどうか_記録

    private void button1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
      {
       if(beginmove)
       {
        int diffx,diffy;
        diffx =  mousePos.X - e.X;
        diffy =  mousePos.Y - e.Y;
        this.button1.Location = new Point(button1.Location.X-diffx,button1.Location.Y-diffy);//buttonの位置変化
       }  
      }

      private void button1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
      {
       beginmove=true;//移動始め
       mousePos=new Point(e.X,e.Y);
      }

      private void button1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
      {
          beginmove = false;//移動終わり
      }

  • 相关阅读:
    mybatis入门
    windows环境下搭建RocketMQ
    主键-雪花算法
    Springboot杂七杂八
    springboot整合webSocket的使用
    sss
    sss
    sss
    sss
    sss
  • 原文地址:https://www.cnblogs.com/Amor/p/217333.html
Copyright © 2011-2022 走看看