C# Windows 7 文件资源管理器树中使用的字体和大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1658549/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What font and size is used in Windows 7 File Explorer Tree
提问by Stefan Koell
I am having a hard time to find out which font is used by the Win 7 File Explorer in the tree view on the left hand side. Better, of course, would be if I can programmatically find out which the right font is (C#).
我很难在左侧的树视图中找出 Win 7 文件资源管理器使用的字体。当然,如果我能以编程方式找出正确的字体是 (C#),那就更好了。
I searched the Windows 7 design guidelines but this particular scenario is not listed (at least I couldn't find it).
我搜索了 Windows 7 设计指南,但没有列出这个特定的场景(至少我找不到)。
So anyone good with fonts?
那么有谁擅长字体吗?
采纳答案by Windows programmer
P/Invoke to SystemParametersInfo with SPI_GETICONTITLELOGFONT.
P/使用 SPI_GETICONTITLELOGFONT 调用 SystemParametersInfo。
It depends on the language version of Windows. If you look at Robert Harvey's answer, you'll see a character that can't be displayed by Segoe UI.
这取决于 Windows 的语言版本。如果您查看 Robert Harvey 的回答,您会看到 Segoe UI 无法显示的字符。
回答by Robert Harvey
Actually it's probably Segoe UI
.
其实大概是Segoe UI
。
If you right-click on the desktop and select Personalize from the menu that pops up, you should find a place in there that will tell you what the default window content font is.
如果您右键单击桌面并从弹出的菜单中选择个性化,您应该会在其中找到一个位置,该位置会告诉您默认的窗口内容字体是什么。
回答by Anthony Mills
It's Segoe UI. In the future, you can use WhatTheFontto resolve any questions you have about what font something is.
这是 Segoe 用户界面。将来,您可以使用WhatTheFont来解决您对某些字体是什么的任何问题。
回答by Quarkly
It is not Segoe. I've spent the last three days attempting to reverse engineer Windows Explorer in Windows 7. Having worked with WPF and Vista, Segoe UI was my first choice for a font family, but I can confirm that it doesn't match up exactly with what Windows Explorer is using.
它不是 Segoe。在过去的三天里,我一直试图在 Windows 7 中对 Windows Explorer 进行逆向工程。 使用 WPF 和 Vista 后,Segoe UI 是我字体系列的首选,但我可以确认它与什么不完全匹配正在使用 Windows 资源管理器。
回答by Quarkly
I took the liberty of capturing Windows Explorer with PAINT.NET (a great utility) and wrote the identical text above the captured text. Here's what I can tell you. The Font in Windows Explorer appears to be some compressed form of Seqoe UI. There's simply no other font that's close enough. However, it become apparent when you have a long word or phrase that the width has been compressed and the pixels bleed (aliasing). I've not yet found out how to reproduce the exact spacing, but I'm pretty convinced of the following:
我冒昧地使用 PAINT.NET(一个很棒的实用程序)捕获 Windows 资源管理器,并在捕获的文本上方写下相同的文本。这是我可以告诉你的。Windows 资源管理器中的字体似乎是 Seqoe UI 的某种压缩形式。没有其他字体足够接近。但是,当您有一个很长的单词或短语时,很明显宽度已被压缩并且像素流血(混叠)。我还没有找到如何重现确切的间距,但我非常相信以下几点:
- The font used by Windows Explorer is Segoe UI.
- The point size is most likely 9.
- The font is definitely compressed from what you would get using Seqoe UI 9.0.
- Windows Explorer 使用的字体是 Segoe UI。
- 点大小很可能是 9。
- 该字体绝对是从您使用 Seqoe UI 9.0 获得的压缩。
回答by Quarkly
After working on this subject for several months, here's what I've concluded: The default font is in fact Segoe UI, 9 pt. (12 pixels). However, there is something going on with the 'SnapsToDevicePixels' in Win32 that isn't or can't be emulated with WPF. If you start to mess with the boundaries of your text in fractions, you can start to see some of the aliasing that goes on with fonts. For example, place a simple canvas in front of your text block and give it a width of, say, 7.5 and you'll see your text start to 'bleed' into the surrounding pixels. I've played around with every combination of fractional spacing and fractional fonts and still can't exactly reproduce the text we see with Windows Explorer. This leaves me with the conclusion that Win32 text is simply rendered with a different engine than WPF.
在研究这个主题几个月后,我得出的结论是:默认字体实际上是 Segoe UI,9 pt。(12 像素)。但是,Win32 中的“SnapsToDevicePixels”存在一些不能或不能用 WPF 模拟的问题。如果您开始在分数中弄乱文本的边界,您可以开始看到一些字体出现的锯齿。例如,在您的文本块前面放置一个简单的画布,并为其设置宽度,例如 7.5,您将看到您的文本开始“渗入”周围的像素。我已经尝试过小数间距和小数字体的每种组合,但仍然无法完全重现我们在 Windows 资源管理器中看到的文本。
回答by Robert Paulson
From the Typography in WPFtopic, have you tried the Font Stretchproperty?
从WPF主题中的排版中,您是否尝试过Font Stretch属性?
回答by integratorIT
That font is Tahoma 7,7pt - checked pixel-in-pixel in Photoshop, in Windows Server 2008.
该字体是 Tahoma 7,7pt - 在 Windows Server 2008 中的 Photoshop 中逐像素检查。
回答by se5a
Windows7 Aero or Windows7 Basic themes use Sagoe.
Windows7 "Windows Classic" theme uses Tahoma.
Windows7 Aero 或 Windows7 Basic 主题使用 Sagoe。
Windows7“Windows Classic”主题使用 Tahoma。
回答by MrWuf
The font is indeed Segoe UI, 9 pt. However, the Graphics.DrawString()
and TextRenderer.DrawText()
methods render the font a little differently. If you use Graphics.DrawString()
, the text will appear to have more kerning than Windows uses. TextRenderer.DrawText()
appears to mimic the exact font that FileExplorer uses.
字体确实是 Segoe UI,9 pt。但是,Graphics.DrawString()
和TextRenderer.DrawText()
方法呈现的字体略有不同。如果使用Graphics.DrawString()
,则文本的字距调整将比 Windows 使用的多。 TextRenderer.DrawText()
似乎模仿 FileExplorer 使用的确切字体。