C# - 上任务栏鼠标悬停时,产生预览。我如何通过C#编码实现这一目标 [英] C# - on mouseover at taskbar, a preview is generated. how can i achieve this by C# coding

查看:1139
本文介绍了C# - 上任务栏鼠标悬停时,产生预览。我如何通过C#编码实现这一目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个WinForm应用程序中,我正在列出所有正在运行的进程。在任何过程中鼠标悬停
,我要像(在Windows 7中,当鼠标悬停在任务栏的应用程序,生成预览显示应用程序窗口中的内容。)
见图像预览窗口

I am developing a winForm application in which i am list all the running processes. on mouseover of any process, i want preview window like (In Windows 7, when you mouse over an application in your task bar, a preview is generated showing the contents of the application window.) See Image.

不知道如何做到这一点,我不能够得到它。
任何建议将是有益的。
谢谢..

Any idea how to achieve this, i am not able to get it. Any suggestion will be helpful. Thanks..

推荐答案

在这个完整的例子的 网站 结果
你需要两个功能:

full example at this site
You need two functions :

[DllImport("dwmapi.dll")]
static extern int DwmRegisterThumbnail(IntPtr dest, IntPtr src, out IntPtr thumb);

[DllImport("dwmapi.dll")]
static extern int DwmUpdateThumbnailProperties(IntPtr hThumb, ref DWM_THUMBNAIL_PROPERTIES props);



DwmRegisterThumbnail结果$ B $的使用B您是在您的格式过程它,你想在你的程序画一个外部程序。

usage of DwmRegisterThumbnail
you are at your form, and process it a external program that you want to paint at your program.

IntPtr hWnd = process.MainWindowHandle;
int i = DwmRegisterThumbnail(this.Handle, hWnd, out thumb);



注册后,你只说给窗口的位置画的图片

after registration, you just saying to windows the location to paint the picture

            DWM_THUMBNAIL_PROPERTIES props = new DWM_THUMBNAIL_PROPERTIES();

            props.fVisible = true;
            props.dwFlags = DWM_TNP_VISIBLE | DWM_TNP_RECTDESTINATION | DWM_TNP_OPACITY;
            props.opacity = 255;
            props.rcDestination = new Rect(panel.Left, panel.Top, panel.Right, panel.Bottom);

            DwmUpdateThumbnailProperties(thumb, ref props);

这篇关于C# - 上任务栏鼠标悬停时,产生预览。我如何通过C#编码实现这一目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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