如何在运行时获取标准WPF控件的工具箱图标?

发布于 2024-09-05 23:18:24 字数 221 浏览 9 评论 0原文

我尝试了这样的事情:

var attrs = typeof(System.Windows.Controls.ComboBox).GetCustomAttributes(typeof(System.Drawing.ToolboxBitmapAttribute), true);

...但是 attrs 是空集合。我还尝试在程序集中查找图标资源,但什么也没找到。

I tried something like this:

var attrs = typeof(System.Windows.Controls.ComboBox).GetCustomAttributes(typeof(System.Drawing.ToolboxBitmapAttribute), true);

...but attrs is empty collection. I also tried to look up for icons resources in assemblies and nothing found.

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

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

发布评论

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

评论(2

Bonjour°[大白 2024-09-12 23:18:24

这是因为 ComboBox 类是实际的运行时类,它没有这样的属性。您需要找到设计时类。我简要浏览了一些 WPF 程序集,但没有找到它。

That's because the ComboBox class is the actual run-time class, which has no such attributes. You'll need to find the design-time class. I've briefly looked through some of the WPF assemblies but couldn't find it.

‖放下 2024-09-12 23:18:24

我猜想WPF标准控件的大部分图标都包含在Visual Studio图像库中:
https://msdn.microsoft.com/en-us/library/ms246582。 ASPX

I guess that most of the icons for WPF standard controls are included in the Visual Studio Image Library:
https://msdn.microsoft.com/en-us/library/ms246582.aspx

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