winform 无边框窗体拖拽实现
Posted 不会撩妹的白芒果
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了winform 无边框窗体拖拽实现相关的知识,希望对你有一定的参考价值。
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; } } } }
以上是关于winform 无边框窗体拖拽实现的主要内容,如果未能解决你的问题,请参考以下文章