C#设置窗口桌面图标背后 [英] C# Set Window Behind Desktop Icons

查看:276
本文介绍了C#设置窗口桌面图标背后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在屏幕上0,0坐标100像素有一个空的形式100px的。它没有边框样式。有什么办法能有这个定位背后的桌面图标?

Assume i have an empty form 100px by 100px at 0,0 coordinates on the screen. It has no border style. Is there any way to have this positioned BEHIND the desktop icons?

我会假设这是因为多数民众赞成包含了桌面图标将涉及的过程普罗格曼。但不管我怎么努力...获取窗口句柄和不断变化的父母等,我似乎无法得到显示的图标后面的窗口。

I would assume this would involve the process Progman because thats what contains the desktop icons. But no matter what i try... getting window handles and changing parents etc, i cant seem to get the window to appear behind the icons.

任何想法?

推荐答案

从本质上讲要绘制桌面的壁纸<上/ em>的。桌面层次结构是这样的:

Essentially you want to draw on the desktop wallpaper. The desktop hierarchy looks like this:

"Program Manager" Progman
  "" SHELLDLL_DefView
    "FolderView" SysListView32

这是 SysListView32 实际绘制桌面图标,所以这是你要挂钩的。你不能只是贴在它上面的表单;你必须抓住一个 WindowDC 来的手柄和借鉴了DC。

It's the SysListView32 that actually draws the desktop icons, so that's what you have to hook. And you can't just stick your form on top of it; you have to grab a WindowDC to that handle and draw on the DC.

它的可以完成 - 它的的已经完成,但你要使用大量的互操作的。忘了与传统的WinForms表格这样做。我不认为我甚至看到它在C#来完成,虽然确实有人在它的蟒蛇,是否有帮助。我不是我自己编一个Python,但代码很短,很容易理解。

It can be done - it has been done, but you're going to be using a lot of interop. Forget about doing this with a traditional Winforms Form. I don't think I've even seen it done in C#, although somebody did it in python, if that helps. I'm not a python coder myself, but the code is pretty short and easy to understand.

这篇关于C#设置窗口桌面图标背后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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