是否可以获得 WPF Popup 控件的 Hwnd?

Is it possible to get the Hwnd of a WPF Popup control?(是否可以获得 WPF Popup 控件的 Hwnd?)
本文介绍了是否可以获得 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
dropbox-sdk-dotnet: how to get a refresh token and update the access token(Dropbox-SDK-Dotnet:如何获取刷新令牌并更新访问令牌)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)