弹框打印

PrintDialog pd = new PrintDialog();
pd.ShowDialog();
//↓第一个参数是StackPanel控件里面放一个label放打印的文字
pd.PrintVisual(spdaying, "学生信息");

直接打印

using System.Drawing;
using System.Drawing.Printing;

PrintDocument pd = new PrintDocument();
//+=的事件 可以按Tab按钮快速创建代码!!!
pd.PrintPage += pd_PrintPage;
pd.Print();

void pd_PrintPage(object sender, PrintPageEventArgs e)
{
    string info = "打印内容\n";
    //e.图表算法.绘制字符串,Brushes刷子
    e.Graphics.DrawString(info, new Font("正常", 15),System.Drawing.Brushes.Black,0,0);
}
//打印条形码
Bitmap bp = new Bitmap("1.jpg");
e.Graphics.DrawImage(bp, 0, 0,210,100);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
  • 2021-05-16
  • 2022-12-23
猜你喜欢
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2021-05-16
相关资源
相似解决方案