OpenThemeData 函数可能有哪些类?

发布于 2024-07-08 06:20:35 字数 342 浏览 8 评论 0原文

我正在尝试调用 OpenThemeData (请参阅 msdn OpenThemeData) 函数,但我无法确定由 pszClassList 参数传入的可接受的类名称。

HTHEME OpenThemeData(      
    HWND hwnd,
    LPCWSTR pszClassList
);

谁能告诉我可以传递给该参数的可接受的类名是什么? 谢谢!

I'm trying to call the OpenThemeData (see msdn OpenThemeData) function but I couldn't determine what are the acceptable Class names to be passed in by the pszClassList parameter.

HTHEME OpenThemeData(      
    HWND hwnd,
    LPCWSTR pszClassList
);

Could anybody tell me what are the acceptable class names that I can pass into that parameter?
Thanks!

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

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

发布评论

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

评论(5

飘过的浮云 2024-07-15 06:20:35

文章部分和状态 包含一个表格,其中显示控制类部件状态。 表中的值在 Vsstyle.hVssym32.h 中定义。

这是一个快速参考:

BUTTON, CLOCK, COMBOBOX, COMMUNICATIONS, CONTROLPANEL, DATEPICKER, DRAGDROP, 
EDIT, EXPLORERBAR, FLYOUT, GLOBALS, HEADER, LISTBOX, LISTVIEW, MENU, MENUBAND, 
NAVIGATION, PAGE, PROGRESS, REBAR, SCROLLBAR, SEARCHEDITBOX, SPIN, STARTPANEL, 
STATUS, TAB, TASKBAND, TASKBAR, TASKDIALOG, TEXTSTYLE, TOOLBAR, TOOLTIP, 
TRACKBAR, TRAYNOTIFY, TREEVIEW, WINDOW

问题的答案 Windows视觉主题:零件和状态画廊?提供了一个“零件和状态资源管理器”应用程序,您可以在其中浏览和测试大多数样式。

The article Parts and States on MSDN contains a table which shows the control classes, parts, and states. The values in the table are defined in Vsstyle.h and Vssym32.h.

Here is a quick reference:

BUTTON, CLOCK, COMBOBOX, COMMUNICATIONS, CONTROLPANEL, DATEPICKER, DRAGDROP, 
EDIT, EXPLORERBAR, FLYOUT, GLOBALS, HEADER, LISTBOX, LISTVIEW, MENU, MENUBAND, 
NAVIGATION, PAGE, PROGRESS, REBAR, SCROLLBAR, SEARCHEDITBOX, SPIN, STARTPANEL, 
STATUS, TAB, TASKBAND, TASKBAR, TASKDIALOG, TEXTSTYLE, TOOLBAR, TOOLTIP, 
TRACKBAR, TRAYNOTIFY, TREEVIEW, WINDOW

The answer to the question Windows Visual Themes: Gallery of Parts and States? provides a "Parts and States Explorer" application where you can browse and test most of the styles.

迷爱 2024-07-15 06:20:35

我知道这是一个老问题,但我想为那些从 Google 来到这里的人提供更新的答案(2018)。

DavidK 接受的答案是查看定义主题的文件“AeroStyle.xml”。 该文件是 Windows 7 SDK 的一部分,但已从 Windows 10 SDK 中删除,因此接受的答案不再有用。

飞溅的答案链接到MSDN,其中主题名称、部分和状态的列表非常不完整且未更新。

主题由UxTheme.dll绘制,它从C:\Windows\Resources\文件夹中的文件aero.msstyles读取图像和颜色等。 Windows 10 上的 Themes\Aero

要查看 XYZ.msstyles 文件中的类,请使用 msstyles.Editor:
https://github.com/nptr/msstyleEditor

只有通过正确的验证才能获得多个主题窗户把手。 似乎有一种自动机制可以从窗口句柄检测控件的类型。 如果您传递了错误窗口的句柄,您可能会得到另一个主题句柄,而不是预期的,甚至是NULL

Microsoft 内部已更改所有代码以使用 OpenThemeDataForDpi() 而不是 OpenThemeData(),因为 Windows 10 上的每个显示器可能具有不同的分辨率。

我们遇到的问题是 MSDN 中严重缺乏文档,并且缺乏枚举所有可用主题的 API 函数。 微软真丢脸(再一次)。

I know this is an old question, but I want to give an updated answer (2018) for those who come here from Google.

The accepted answer of DavidK says to look into the file "AeroStyle.xml" where the themes are defined. This file was part of the Windows 7 SDK, but has been removed from the Windows 10 SDK, so the accepted answer is not useful anymore.

The answer of splash links to the MSDN where the list of theme names, parts and states is highly incompetlete and not updated.

The themes are drawn by UxTheme.dll which reads the images and colors, etc. from the file aero.msstyles in the folder C:\Windows\Resources\Themes\Aero on Windows 10.

To see the classes inside the XYZ.msstyles file use msstyles.Editor:
https://github.com/nptr/msstyleEditor

Several themes can only be obtained if you pass the correct window handle. There seems to be an automatic mechanism which detects the type of control from a window handle. If you pass the handle of the wrong window you may get another theme handle than expected or even NULL.

Microsoft internally has changed all their code to use OpenThemeDataForDpi() instead of OpenThemeData() because each monitor on Windows 10 may have a different resolution.

The problem that we have here is a severe lack of documentation in the MSDN and a lack of an API function to enumerate all availabe themes. Shame on Microsoft (once more).

杯别 2024-07-15 06:20:35

您可以查看之前海报中提到的“AeroStyle.xml”,其中提供了 Vista/Aero 的准确列表。 但是,如果您想安全起见(您可能会这样做),那么类名称通常应该是 Windows 公共控件的 Windows 类名称。 例如,按钮和复选框使用类名“Button”,编辑控件“Edit”等。我通常选择与我正在处理的任何自定义元素最接近的控件的类名,并使用主题数据。 这样,您将获得适用于 XP、Vista 和(希望如此)Windows 7 的代码,无论用户实际选择的主题是什么。

但是,除非您经常使用原始 Win32,否则您可能不会直接使用类名进行太多控件创建。 类名在 MSDN 中随处可见。 一个好的起点通常是 Platform SDK 中的“CommCtrl.h”文件,其中包含很多此类控件,而且它们始终在 MSDN 帮助中有关各个常用控件的描述中。 您通常还可以通过在文本编辑器中打开 .rc 文件来查看如何定义对话框来学习它们:这些文件包含控件的类名称。

You can look in "AeroStyle.xml" as a previous poster noted, which gives an exact list for Vista/Aero. However, if you want to play safe (and you probably do) the class names should, in general, be Windows class names of Windows common controls. For example, push buttons and check boxes use the class name "Button", the edit control "Edit", etc. I generally pick the class name of the control that's closest to whatever custom element I'm working on is, and use the theme data for that. That way you'll get code that works with XP, Vista and (hopefully) Windows 7, regardless of what the user's selected theme actually is.

However, unless you use raw Win32 a lot, you probably don't do much control creation directly using the class name. The class names are rather liberally sprinkled throughout MSDN. A good place to start is usually the "CommCtrl.h" file from the Platform SDK, which has a lot of them, and they're always described in the MSDN help on the individual common controls. You can also often learn them by looking at how dialogs are defined in .rc files by opening them in a text editor: these contain the class name for the controls.

月牙弯弯 2024-07-15 06:20:35

类名称取决于主题。 例如,正如 OpenThemeData 的文档所述:

Aero 主题的类名称是
在 AeroStyle.xml 中定义,即
在包含文件夹中找到
微软Windows软件开发
套件(SDK)。

Class names depend on the theme. For example, as the documentation for OpenThemeData states:

Class names for the Aero theme are
defined in AeroStyle.xml, which is
found in the Include folder of the
Microsoft Windows Software Development
Kit (SDK).

寒尘 2024-07-15 06:20:35

它与 Aero 无关,甚至在 XP 上也不存在!
请参阅 OpenThemeData() 的源代码..

It has nothing to do with Aero, which even doesn't exits on XP !
See the source code of OpenThemeData()..

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