Tag: 印刷

使用C#确定当前的打印作业颜色

在来到SO寻找答案之前,我花了最后2或3天在Google上尝试不同的问题表单来尝试让它发挥作用。 我需要获取当前打印作业的颜色设置,以确定用户执行了多少彩色或灰度打印。 但是我试图访问的每个颜色属性(通过ManagementObjectSearcher,“Watcher和C#的内置打印机类”)总是返回颜色,而不是灰度。 任何帮助将不胜感激,因为我已经停止在解决方案上取得进展。 谢谢。 下面是我的代码(请记住它是我的原型代码,所以除了我要问的问题之外可能还有很多问题。请仅提供您对我的问题的答案的建议)。 using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Printing; using System.Management; using System.Management.Instrumentation; using System.Threading; using System.Windows.Threading; using System.Diagnostics; namespace PrintPlus { public partial class PrintPlus : Form { #region Objects // Mgmt ManagementEventWatcher watcher; ManagementObjectSearcher searcher; // […]

使用WPF进行C#打印

我的应用程序打印(到打印机)屏幕上显示的信息(使用Canvas控件)N次。 这个过程是 用户单击按钮(称为“打印”)。 使用文本更新Canvas(通常来自数据库但是对于下面的代码,它是硬编码的) 打印到打印机 使用新文本更新canvas(再次从数据库更新,但对于下面的代码,它是硬编码的)打印到打印机 但是,我无法按照上述过程中的说明进行操作 – 打印机仅打印上次更新。 为了使这个问题可以复制,我附上下面的代码 我的XAML 和我的代码背后 using System; using System.Windows; using System.Printing; using System.Windows.Threading; using System.Windows.Controls; namespace WpfApplication4 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { PrintDialog dialog = new […]

C#使用ICC配置文件将RGB值转换为CMYK?

这个问题似乎发布在很多地方的interwebs和SO,但我找不到一个满意的答案:( 如何使用ICC配置文件将RGB值转换为CMYK值? 我有最接近的答案,它解释了如何从CMYK转换为RGB而不是相反,这是我需要的。 (http://stackoverflow.com/questions/4920482/cmyk-to-rgb-formula-of-photoshop/5076731#5076731) float[] colorValues = new float[4]; colorValues[0] = c / 255f; colorValues[1] = m / 255f; colorValues[2] = y / 255f; colorValues[3] = k / 255f; System.Windows.Media.Color color = Color.FromValues(colorValues, new Uri(@”C:\Users\me\Documents\ISOcoated_v2_300_eci.icc”)); System.Drawing.Color rgbColor = System.Drawing.Color.FromArgb(color.R, color.G, color.B); 我想我应该使用System.Windows.Media命名空间中的一些类/结构/方法。 System.Windows.Media.Color结构包含一个方法FromRgb,但是我无法在System.Windows.Media.Color中获取CMYK值! 非常感谢