C# WPF 获取窗体和控件的句柄

窗体:
IntPtr hwnd = new WindowInteropHelper(this).Handle;


控件:
IntPtr hwnd = ((HwndSource)PresentationSource.FromVisual(uielement)).Handle;

猜你喜欢

转载自www.cnblogs.com/lipengxu/p/10265123.html