R
Ravikanth[MVP]
Hello,
You can use the PrintDocument component to use the
default printer. If you don't specify a printer to the
PrintDocument object, by default, it will
use the default printer.
This is a sample code;
private void print_Click(object sender, System.EventArgs
e)
{
printDocument1.Print(); //It will use default
printer
}
private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.FillRectangle(Brushes.Red, new Rectangle
(500, 500, 500, 500));
}
If you dont want to print a document, but just want to
retrieve the information about the default printer. You
can create a PrintDocument and access its PrinterSettings
Property. You can get the information such as PinterName
and PaperSize from the Property.
PrintDocument printDocument1 = new PrintDocument();
MessageBox.Show
(printDocument1.PrinterSettings.PrinterName);
For more information about PrintDocument please see:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpref/html/
frlrfSystemDrawingPrintingPrintDocumentClassTopic.asp
I hope this is helpful for you.
Ravikanth[MVP]
You can use the PrintDocument component to use the
default printer. If you don't specify a printer to the
PrintDocument object, by default, it will
use the default printer.
This is a sample code;
private void print_Click(object sender, System.EventArgs
e)
{
printDocument1.Print(); //It will use default
printer
}
private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.FillRectangle(Brushes.Red, new Rectangle
(500, 500, 500, 500));
}
If you dont want to print a document, but just want to
retrieve the information about the default printer. You
can create a PrintDocument and access its PrinterSettings
Property. You can get the information such as PinterName
and PaperSize from the Property.
PrintDocument printDocument1 = new PrintDocument();
MessageBox.Show
(printDocument1.PrinterSettings.PrinterName);
For more information about PrintDocument please see:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpref/html/
frlrfSystemDrawingPrintingPrintDocumentClassTopic.asp
I hope this is helpful for you.
Ravikanth[MVP]