//引用命名空间 System.Runtime.InteropServices
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);先添加上边语句,然后编写控件MouseMove事件的处理程序(下边代码移动PictureBox控件):
pictureBox1.MouseMove += delegate(object sender, MouseEventArgs e)
{
PictureBox picbox = (PictureBox)sender;
picbox.Capture = false;
SendMessage(picbox.Handle, 0x0112, 0xF012, 0);
};
评论(0)
暂无评论。