I have the following code that should be printing a chart in color. Other things I print nicely print in color but not this chart.
private void button1_Click(object sender, EventArgs e) { PrintDocument doc = ultraChart1.PrintDocument; printDialog1.Document = ultraChart1.PrintDocument; DialogResult res = printDialog1.ShowDialog(this);
if (res == DialogResult.OK) { PrinterSettings printer1 = printDialog1.PrinterSettings; PageSettings page1 = new PageSettings(); // Set the page orientation to landscape. page1.Landscape = true; page1.Color = true; this.ultraChart1.PrintChart(printer1, page1); } }
Hello Sam,
Which version of Infragistics for Windows Forms do you experience this behavior? Have you tried testing with a different printer? Have you printed to the Microsoft XPS Document Writer (to stay green)? This is selectable in the Print dialog when selecting the printer.
The UltraChart and all other .Net controls do not explicitly control whether they're printed in color or not. Therefore this could be a hardware/environment related issue.
I put together a sample using our latest version (14.1) that uses your code along with our UltraPrintPreviewDialog and selected to print to the XPS Document Writer and to our color printer and the chart prints in color just fine.
Let me know if you have any questions regarding this matter.
Thank you. I'm not sure what part of environment would cause this, but I'll figure it out.
Your welcome. Let me know if you have any additional questions.
I just wanted to update the answer I actually found.
PrintDocument doc = ultraChart1.PrintDocument;
printDialog1.Document = ultraChart1.PrintDocument; DialogResult res = printDialog1.ShowDialog(this); printDialog1.PrinterSettings.DefaultPageSettings.Color = true; printDialog1.PrinterSettings.DefaultPageSettings.Landscape = true; if (res == DialogResult.OK) { this.ultraChart1.PrintChart(printDialog1.PrinterSettings, printDialog1.PrinterSettings.DefaultPageSettings); }
I am glad you found an answer. Let me know if you have any additional questions about the UltraChart.