窗口中也设定了
this.SetStyle(ControlStyles.DoubleBuffer , true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint , true);
this.SetStyle(ControlStyles.UserPaint,true);
this.SetStyle(ControlStyles.DoubleBuffer , true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint , true);
this.SetStyle(ControlStyles.UserPaint,true);
using System.Runtime.InteropServices;public const int WM_SYSCOMMAND=0x0112;
public const int SC_MOVE=0xF010;
public const int HTCAPTION=0x0002;
[DllImport("user32.dll", EntryPoint="SendMessageA")]
private static extern int SendMessage (IntPtr hwnd, int wMsg, int wParam, int lParam);
[DllImport("user32.dll")]
private static extern int ReleaseCapture ();
private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
ReleaseCapture();
SendMessage(pictureBox1.Handle,WM_SYSCOMMAND,SC_MOVE+HTCAPTION, 0);
}
http://www.microsoft.com/china/MSDN/library/netFramework/netframework/VCSdragdrop_datagrid.mspx