按鈕拖拽移動

世紀緣發表於2016-11-03
      private void button1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Button btn = (Button)sender;
                btn.Location = new Point(PointToClient(MousePosition).X - 30, PointToClient(MousePosition).Y - 30);
            }
        }

相關文章