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); 
  •             } 
  •         } 
  •     } 
  • }

WinForm 无边框窗体 拖动工作区移动窗体 (转),布布扣,bubuko.com

WinForm 无边框窗体 拖动工作区移动窗体 (转)

上一篇:iOS问题解答


下一篇:canvas玩转微信红包