Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

color printing

Status
Not open for further replies.

merlinv

Programmer
Jun 11, 2001
32
0
0
US
How do I determine if a printer supports color printing?
An example would be useful.

Thanks

MerlinV
 
From MSDN help:
printDoc is a PrintDocument class instance.
Code:
  private void MyButtonPrint_OnClick(object sender, System.EventArgs e)
    {
        
        // Set the printer name and ensure it is valid. If not, provide a message to the user.
        printDoc.PrinterSettings.PrinterName = "\\mynetworkprinter";

        if (printDoc.PrinterSettings.IsValid) {
        
            // If the printer supports printing in color, then override the printer's default behavior.
            if (printDoc.PrinterSettings.SupportsColor) {

                // Set the page default's to not print in color.
                printDoc.DefaultPageSettings.Color = false;
            }

            // Provide a friendly name, set the page number, and print the document.
            printDoc.DocumentName = "My Presentation";
            currentPageNumber = 1;
            printDoc.Print();
        }
        else {
            MessageBox.Show("Printer is not valid");
        }
    }

    private void MyPrintQueryPageSettingsEvent(object sender, QueryPageSettingsEventArgs e)
    {
        // Determines if the printer supports printing in color.
        if (printDoc.PrinterSettings.SupportsColor) {

            // If the printer supports color printing, use color.
            if (currentPageNumber == 1 ) {

                e.PageSettings.Color = true;
            }

        }    
    }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top