是否可以获取WPF Popup控件的Hwnd? [英] Is it possible to get the Hwnd of a WPF Popup control?

查看:310
本文介绍了是否可以获取WPF Popup控件的Hwnd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要对自定义形状的WPF窗口的一部分应用Aero背景模糊.问题是要对DWM应用模糊,我需要为DwmEnableBlurBehindWindow函数提供一个窗口句柄.

I need to apply an Aero background blur to only part of a custom-shaped WPF window. The problem is that to apply the blur with DWM, I need to provide a window handle to the DwmEnableBlurBehindWindow function.

有人告诉我WPF弹出控件实际上是一个单独的窗口.那很好.我可以获取弹出窗口的句柄以对其应用模糊处理吗?如果是这样,怎么办?

I have been told that the WPF popup control is actually a separate window. That is good. Can I get a popup's handle to apply blur to it? If so, how?

推荐答案

尝试一下

HwndSource source = (HwndSource)HwndSource.FromVisual(myPopup)

或此,但此仅适用于实际的Windows,但可能对将来的参考有所帮助.

or this but this one only works for actual Windows, but might help for future references.

IntPtr handle = new WindowInteropHelper(myWindow).Handle;

这篇关于是否可以获取WPF Popup控件的Hwnd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆