WinForm 无边框窗体 拖动工作区移动窗体
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace TestShow
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- Point downPoint;
- privatevoid pictureBox1_MouseDown(object sender, MouseEventArgs e)
- {
- downPoint = new Point(e.X, e.Y);
- }
- privatevoid pictureBox1_MouseMove(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- this.Location = new Point(this.Location.X + e.X - downPoint.X,
- this.Location.Y + e.Y - downPoint.Y);
- }
- }
- }
- }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。