C#惠普打印机打印
打印机通用:
禹城网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、自适应网站建设等网站项目制作,到程序开发,运营维护。创新互联于2013年开始到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联。
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font font = new Font("宋体", 12);
Brush bru = Brushes.Black;
Image bitmap = new Bitmap(panel1.BackgroundImage.Width, panel1.BackgroundImage.Height);
Graphics g = e.Graphics; //先建立画布
g.DrawImage(bitmap, 0, 0);
int x = 0;//调整位置信息
int y = 0;
foreach (Control item in panel1.Controls)
{
if (item is TextBox)
{
Control tx = (item as Control);
g.DrawString(tx.Text, font, bru, tx.Left + x, tx.Top + y);
}
if (item is PictureEdit)
{
Control tx = (item as Control);
e.Graphics.DrawImage(pictureEdit1.Image, tx.Left + x, tx.Top + y);
}
}
}
//打印
private void simpleButton1_Click(object sender, EventArgs e)
{
PrintText();
PrintDialog pdia = new PrintDialog();
PrintDocument pdoc = new PrintDocument();
pdoc.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
if (pdia.ShowDialog() == DialogResult.OK)
{
pdoc.Print();
}
}
网页题目:C#惠普打印机打印
网页地址:http://hbruida.cn/article/jjhiii.html