复制代码 代码如下:
class WinAPI{ [DllImport("coredll.dll")] private static extern IntPtr SetCapture(IntPtr hWnd);[DllImport("coredll.dll")]
private static extern IntPtr GetCapture();
public static IntPtr GetHWnd(Control ctrl)
{ IntPtr hOldWnd = GetCapture();ctrl.Capture = true;
IntPtr hWnd = GetCapture();
ctrl.Capture = false;
SetCapture(hOldWnd);
return hWnd;
}}
精彩评论