WinForm窗体拖动代码
生活随笔
收集整理的這篇文章主要介紹了
WinForm窗体拖动代码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文轉載自:http://www.cnblogs.com/ap0606122/archive/2012/10/23/2734964.html
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace WindowsApplication1{public partial class Form1 : Form{public Form1(){InitializeComponent();}private Point mPoint = new Point();private void Form1_MouseDown(object sender, MouseEventArgs e){mPoint.X = e.X;mPoint.Y = e.Y;}private void Form1_MouseMove(object sender, MouseEventArgs e){if (e.Button == MouseButtons.Left){Point myPosittion = MousePosition;myPosittion.Offset(-mPoint.X, -mPoint.Y);Location = myPosittion;} }}}確實好使
轉載于:https://www.cnblogs.com/wpcnblog/p/5775092.html
總結
以上是生活随笔為你收集整理的WinForm窗体拖动代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: iOS 13.3正式版掉电快吗iOS 1
- 下一篇: 插件~Nuget中包与包的依赖关系