确保实现 WPF 任务栏窗口预览 [英] Ensure WPF Taskbar Window Preview is actualized

查看:32
本文介绍了确保实现 WPF 任务栏窗口预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I ensure that the hower preview of my WPF application (.net 4) is refreshed when the user places the mouse over the taskbar icon.
I have an app that visualizes some status values. If the app window is minimized and the user hovers over the taskbar button, the preview window that is shown shows the last view of the window at which the window was active. However I would like to have an actualized view.
Is there a possiblity to achieve that?

推荐答案

我相信您需要自定义预览,如此处(在自定义预览"部分下).它利用了 适用于 Microsoft® .NE​​T Framework 的 Windows API 代码包.

I believe you'd need to customize the preview, as described here (under the Customizing Preview section). Which leverages the Windows API Code Pack for Microsoft® .NET Framework.

可以在此处找到示例,但看起来像:

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;
    };

另一个例子,可以找到此处 指出:

Another example, can be found here which states:

CustomWindowsManager 类提供了一个抽象自定义窗口缩略图预览和实时预览 (peek),包括接收通知的设施当请求预览位图时桌面窗口管理器 (DWM) 和自动抓取预览一个窗口的位图.

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.

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

The download link for this code is here, which includes the CustomWindowsManager class. This appears to provide the live preview.

这篇关于确保实现 WPF 任务栏窗口预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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