#2
asad2022-03-07 23:32
|
{
printDoc.PrinterSettings.PrinterName = @"\\192.168.135.130\HP LaserJet Professional P1108"; //“打印机名称”;
}
private void printDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Graphics MyGraphics = e.Graphics;
SolidBrush drawBrush = new SolidBrush(Color.Black);
Font drawFont = new Font("黑体", 10); //字体 和 大小
MyGraphics.DrawString("打印内容1", drawFont, drawBrush, 0, 0);
MyGraphics.DrawString("打印内容2", drawFont, drawBrush,0,100);
}
private void button1_Click(object sender, EventArgs e)
{
this.printDoc.PrintPage += new PrintPageEventHandler(this.printDoc_PrintPage);
printDoc.Print();
}
[此贴子已经被作者于2022-3-9 10:21编辑过]