码迷,mamicode.com
首页 > Windows程序 > 详细

C# 点击窗口任意位置拖动

时间:2015-04-26 06:57:40      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

代码:

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Runtime.InteropServices;
 8 using System.Text;
 9 using System.Threading.Tasks;
10 using System.Windows.Forms;
11 
12 namespace FreeNotes
13 {
14     public partial class kk : Form
15     {
16         public kk()
17         {
18             InitializeComponent();
19         }
20 
21         [DllImport("user32.dll")]
22         public static extern bool ReleaseCapture();
23 
24         [DllImport("user32.dll")]
25         public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
26 
27         private void kk_MouseDown(object sender, MouseEventArgs e)
28         {
29             ReleaseCapture();
30             SendMessage(this.Handle, 0x0112, 0xF012, 0);
31         } 
32     }
33 }

 

C# 点击窗口任意位置拖动

标签:

原文地址:http://www.cnblogs.com/KTblog/p/4457212.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!