C# WinForm拖动无边框窗体
程序员文章站
2022-07-14 13:02:24
...
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;
}
}
}
}
上一篇: 拖动无边框窗体
下一篇: C# 实现无边框窗体拖动