winform 无边框窗体拖拽实现

2021-05-06 03:27

阅读:428

标签:span   win   void   off   sed   mouse   实现   code   forms   

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 无边框窗体拖拽实现

标签:span   win   void   off   sed   mouse   实现   code   forms   

原文地址:http://www.cnblogs.com/baimangguo/p/7674765.html

上一篇:cygwin

下一篇:C#杂乱知识汇总


评论


亲,登录后才可以留言!