【发布时间】:2015-10-14 09:41:22
【问题描述】:
我使用了来自 CodeProject 的精彩文章。 http://www.codeproject.com/Articles/856020/Draw-Behind-Desktop-Icons-in-Windows 这个项目在 Windows 8.1 上对我来说运行良好
使用表单的示例。现在我将更改表格 到 WPF-Window(使用 Visualstudio 2015 和 .net 4.5.2)。
// The WPF-Window for infos behind the icon
public partial class InfoBehindIcon : Window
{
public InfoBehindIcon()
{
InitializeComponent();
// in .xaml: the decoration switched off
}
}
// The MainWindow - class
....
private HInfoBehindIcon.InfoBehindIcon infoBehindIcon = new HInfoBehindIcon.InfoBehindIcon();
public MainWindow()
{
InitializeComponent();
....
iniDesktopHandlerWPF();
... in CodeProject example starting here the Form with
// System.Windows.Forms.Application.Run(InfoBIForm);
... how to start here the WPF-Window behind the Icon?
}
private void iniDesktopHandlerWPF()
{
... Code from CodeProject example
if(dc != IntPtr.Zero)
{
// here I change the Form to WPF-Window
infoBehindIcon.Loaded += infoBehindIcon_EventWPF;
}
}
private void infoBehindIcon_EventWPF(object sender, EventArgs e)
{
infoBehindIcon.Topmost = false;
InfoPanel.HW32.SetParent(new WindowInteropHelper(infoBehindIcon).Handle, workerw);
}
使用表单的版本运行没有问题。 当我尝试对 WPF 进行更改时,第二个窗口正在启动,但是 它没有在桌面和图标之间运行。 有没有办法解决这个问题? 还是更好地使用表格? (对不起,我是 C# 的新手)
【问题讨论】: