用于计算 Windows XP 上桌面图标间距的公式或 API

发布于 2024-07-07 10:48:15 字数 220 浏览 13 评论 0原文

我构建了一个简单的应用程序,它将网格线应用于图像或仅将简单的颜色用作桌面壁纸。 这个想法是桌面图标可以排列在网格内。 问题是,取决于比我理解的更多的事情,实际的像素间距似乎因系统而异。 我了解到至少这些因素起到了一定的作用:

  • 分辨率(废话)
  • 任务栏大小和位置
  • 字体

还不止这些。 也许有一些我不知道的 api 调用?

I've built a simple application that applies grid-lines to an image or just simple colors for use as desktop wallpaper. The idea is that the desktop icons can be arranged within the grid. The problem is that depending on more things than I understand the actual spacing in pixels seems to be different from system to system. I've learned that at least these things play a factor:

  • Resolution (duh)
  • Taskbar size and placement
  • Fonts

There has to be more than this. Maybe there's some api call that I don't know about?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ぶ宁プ宁ぶ 2024-07-14 10:48:15

有 1001 种方法来获取/设置它(但我只知道 2):-D

Windows Register:

HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics

值是 IconSpacingIconVerticalSpacing

通过代码:

using System 。管理;

公共字符串 GetWinIconSpace()

{

ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2","SELECT * FROM Win32_Desktop"); 

foreach (ManagementObject wmi in searcher.Get())
{
    try
    {

        return "Desktop Icon Spacing: " + wmi.GetPropertyValue("IconSpacing").ToString();

    }

    catch { }

}

return "Desktop Icon Spacing: Unknown";

}

和我从未尝试过的第三个你可以找到它这里

there are a 1001 ways to get/set this (but I only know 2) :-D

Windows Register:

HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics

values are IconSpacing and IconVerticalSpacing

by code:

using System.Management;

public string GetWinIconSpace()

{

ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2","SELECT * FROM Win32_Desktop"); 

foreach (ManagementObject wmi in searcher.Get())
{
    try
    {

        return "Desktop Icon Spacing: " + wmi.GetPropertyValue("IconSpacing").ToString();

    }

    catch { }

}

return "Desktop Icon Spacing: Unknown";

}

and the 3rd that I never tried you can find it here

终难遇 2024-07-14 10:48:15

如果所请求的图标尺寸不可用,则它们也可能是由于缩放算法而导致的尺寸问题。
(因为图标文件实际上是图标的集合,正如这个线程中关于 图标和光标知道它们来自哪里,来自旧的新的事情

They might also be a size problem due to scaling algorithm if the requested size of the icon is not available.
(since an icon file is actually a collection of icons, as explained in this thread about Icons and cursors know where they came from, from the The Old New Thing)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文