日期:2014-05-18 浏览次数:20956 次
using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace WindowsFormsApplication4 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [DllImport("user32.dll")] static extern bool ReleaseCapture(); [DllImport("user32.dll", CharSet = CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, UInt32 wParam, UInt32 lParam); private readonly UInt32 WM_SYSCOMMAND = 0x112; private readonly UInt32 SC_MOVE = 0xF010; private readonly UInt32 HTCAPTION = 2; private void button1_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(button1.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); } private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(pictureBox1.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); } private void textBox1_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(textBox1.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); } } }
------解决方案--------------------
http://www.cnblogs.com/xkxjy/archive/2009/04/27/2078103.html
------解决方案--------------------
你去下载个sharpdevelop
那是仿VS软件,还是开源的