View Full Version : سوال: استفاده از پرینتر
pbiuki630
دوشنبه 23 آذر 1388, 10:33 صبح
سلام دوستان
چه جوری باید از کامپوننت پرینتر استفاده کنم برای پرینت یک متن؟
یعنی جه جوری و با چه کدی میتونم از printdialog یا printdocument استفاده کنم؟
bghad1
دوشنبه 23 آذر 1388, 19:14 عصر
سلام...
با استفاده از كد زير مي توني اينكار رو انجام بدي دوست من...
private void چاپToolStripMenuItem_Click(object sender, EventArgs e)
{
PrintDocument docToPrint = new PrintDocument();
// Allow the user to choose the page range he or she would
// like to print.
printDialog1.AllowSomePages = true;
// Show the help button.
printDialog1.ShowHelp = true;
printDialog1.Document = docToPrint;
DialogResult result = printDialog1.ShowDialog();
// If the result is OK then print the document.
if (result == DialogResult.OK)
{
docToPrint.Print();
}
}
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.