询问者
Windows7 Aero主题嵌入WPF桌面窗口不显示

问题
-
我用WPF做了一个美化窗口,并将其嵌入Windows7桌面,嵌入代码如入:
IntPtr deskHandle = FindWindow("Progman", "Program Manager");
SetParent(new WindowInteropHelper(this).Handle, deskHandle );
该窗口在“基本和高对比主题”下能够正常显示,但切换到“Aero主题”下,窗口就不显示了(似乎变为完全透明的了),请问各位大虾,问题出在哪儿,要怎么修改程序?
- 已移动 ThankfulHeart 2014年2月23日 1:09 WPF问题
全部回复
-
建议SetWindowLong方法设置下窗体的透明度。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
不行的,我的代码是这样:
IntPtr handle = new WindowInteropHelper(this).Handle;
int rn = GetWindowLong(handle, GWL_EXSTYLE);
SetWindowLong(handle, GWL_EXSTYLE, rn | WS_EX_LAYERED);SetLayeredWindowAttributes(handle, 0, 255, 2);
而且在WPF中,无论SetLayeredWindowAttributes的第三个参数(bAlpha)如何取值,窗口都变为全透明的了。
-
不行的,我的代码是这样:
IntPtr handle = new WindowInteropHelper(this).Handle;
int rn = GetWindowLong(handle, GWL_EXSTYLE);
SetWindowLong(handle, GWL_EXSTYLE, rn | WS_EX_LAYERED);SetLayeredWindowAttributes(handle, 0, 255, 2);
而且在WPF中,无论SetLayeredWindowAttributes的第三个参数(bAlpha)如何取值,窗口都变为全透明的了。
这样行不通吧!Layered Window 跟 DWM 机制不同。