Export (0) Print
Expand All

PrinterSettings.SupportsColor Property

Gets a value indicating whether this printer supports color printing.

Namespace:  System.Drawing.Printing
Assembly:  System.Drawing (in System.Drawing.dll)

public bool SupportsColor { get; }

Property Value

Type: System.Boolean
true if this printer supports color; otherwise, false.

To print using color, and if the printer supports it, set PageSettings.Color to true.

The following code example prints a document with the first page in color, if the printer supports it. The example requires that a PrintDocument variable named printDoc has been created, and the PrintPage and QueryPageSettings events are handled.

Use the System.Drawing and System.Drawing.Printing namespaces for this example.

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;
        }

    }    
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft