[DllImport("user32.dll", EntryPoint="SendMessageA")] private static extern int SendMessage(IntPtr hwnd, uint wMsg, uint wParam, uint lParam); [DllImport("user32.dll")] private static extern int ReleaseCapture(); //move ReleaseCapture(); SendMessage(pictureBox1.Handle, 0x0112, 0xF004, 0); SendMessage(pictureBox1.Handle, 0x0202, 0, 0); /* 0---------1---------2 3-------------------4 5---------6---------7 */ case 0:{ ReleaseCapture(); SendMessage(panel1.Handle, 0x0112, 0xF004, 0); SendMessage(panel1.Handle, 0x0202, 0, 0); break; } case 1:{ ReleaseCapture(); SendMessage(panel1.Handle, 0x0112, 0xF003, 0); SendMessage(panel1.Handle, 0x0202, 0, 0); break; } case 2:{ ReleaseCapture(); SendMessage(panel1.Handle, 0x0112, 0xF005, 0); SendMessage(panel1.Handle, 0x0202, 0, 0); break; } case 3:{ ReleaseCapture(); SendMessage(panel1.Handle, 0x0112, 0xF001, 0); SendMessage(panel1.Handle, 0x0202, 0, 0); break; } case 4:{ ReleaseCapture(); SendMessage(panel1.Handle, 0x0112, 0xF002, 0); SendMessage(panel1.Handle, 0x0202, 0, 0); break; } case 5:{ ReleaseCapture(); SendMessage(panel1.Handle, 0x0112, 0xF007, 0); SendMessage(panel1.Handle, 0x0202, 0, 0); break; } case 6:{ ReleaseCapture(); SendMessage(panel1.Handle, 0x0112, 0xF006, 0); SendMessage(panel1.Handle, 0x0202, 0, 0); break; } case 7:{ ReleaseCapture(); SendMessage(panel1.Handle, 0x0112, 0xF008, 0); SendMessage(panel1.Handle, 0x0202, 0, 0); break; }
原文地址:http://www.cnblogs.com/cause/p/3837914.html