gpt4 book ai didi

wpf - 确保实现 WPF 任务栏窗口预览

转载 作者:行者123 更新时间:2023-12-04 14:51:10 26 4
gpt4 key购买 nike

当用户将鼠标悬停在任务栏图标上时,如何确保刷新 WPF 应用程序 (.net 4) 的预览。
我有一个可视化一些状态值的应用程序。如果应用程序窗口最小化并且用户将鼠标悬停在任务栏按钮上,则显示的预览窗口将显示窗口处于事件状态的窗口的最后一个 View 。但是,我想有一个实现的观点。
有没有可能实现这一目标?

最佳答案

我相信您需要自定义预览,如 here 所述(在自定义预览部分下)。其中利用了 Windows API Code Pack for Microsoft® .NET Framework .

一个例子可以在 here 中找到,但看起来像:

TabbedThumbnail preview = new TabbedThumbnail(parentForm.Handle, childForm.Handle);
TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview);
preview.TabbedThumbnailBitmapRequested += (o, e) =>
{
Bitmap bmp = new Bitmap(width, height);

// draw custom bitmap...

e.SetImage(bmp);
e.Handled = true;
};

另一个例子,可以找到 here其中指出:

The CustomWindowsManager class provides an abstraction of a customized window thumbnail preview and live preview (peek), including the facilities to receive a notification when a preview bitmap is requested by the Desktop Window Manager (DWM) and to automatically grab the preview bitmap of a window.



此代码的下载链接是 here ,其中包括 CustomWindowsManager 类。这似乎提供了实时预览。

关于wpf - 确保实现 WPF 任务栏窗口预览,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6298556/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com