我能否获得通过.NET中安装的打印机相关的图标? [英] Can I get the icon associated with an installed printer through .Net?

查看:203
本文介绍了我能否获得通过.NET中安装的打印机相关的图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何让所有已安装的打印机列表中选择一个机器上的.Net:

I know how to get the list of all of the installed printers on a machine with .Net:

foreach (String printer in PrinterSettings.InstalledPrinters)
{        
    Console.WriteLine(printer.ToString());
}
Console.ReadLine();

InstalledPrinters是一个字符串只是一个列表,但。有没有什么办法让同时包含名称和图标图像,我通常会在设备和打印机在Windows资源管理器查看已安装的打印机对象?

InstalledPrinters is just a list of strings though. Is there any way to get the installed printer objects that contain both the name and the icon image that I would ordinarily see under "Devices and Printers" in the Windows Explorer?

推荐答案

图标通常是嵌入到任何一个dll文件或主EXE文件,看看System.Drawing.Icon静态方法,下面的链接是的WinForms,与WPF,你必须创建从提取的图标流中的I​​mageSource的略有不同。

The icon is normally embedded into either one of the dll files or the main EXE, look at the System.Drawing.Icon static methods, the link below is for WinForms, its slightly different with WPF as you have to create an ImageSource from the extracted icon stream.

如何:提取图标关联在Windows窗体文件

这篇关于我能否获得通过.NET中安装的打印机相关的图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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