using System.Drawing.Printing;
using System.Drawing;
class Printer
{
static void Main()
{
PrintDocument PD = new PrintDocument();
PD.PrintPage += new PrintPageEventHandler(OnPrintDocument);
try
{
PD.Print();
}
catch
{
Console.WriteLine("Bir hata oluştu.");
}
finally
{
PD.Dispose();
}
}
private static void OnPrintDocument(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawRectangle(Pens.Red,20,20,100,100);
}
}