public void PaintToImage()
{
Bitmap bitmap = new Bitmap(500, 200);
Graphics g = Graphics.FromImage(bitmap);
Font font = new Font("宋体", 20, FontStyle.Regular);
Brush brush = new SolidBrush(Color.Black);
int Margin = 0;
g.DrawString("内容", font, brush, 0 + Margin, 50 + Margin);
g.DrawString("内容", font, brush, 0 + Margin, 77 + Margin);
g.DrawString(config.serialNum + ":" + TbSerialNo.Text, font2, brush, 0 + Margin, 103 + Margin);
g.DrawString(dateTimePicker1.Value.ToString("yyyy-MM-dd"), font2, brush, 0 + Margin, 125 + Margin);
string flowCode = "这个是文本内容";
//生成二维码的方法,自定义,自己找一个即可。这行代码不能直接使用。
Bitmap qrCode = QrCodeTool.create_two(flowCode, 8);
g.DrawImage(qrCode, 300, 50, 70, 70);
Font font3 = new Font("宋体", fontSize - 2, FontStyle.Regular);
g.DrawString(TbCode.Text, font3, brush, 220, 120);
pictureBox1.Image = bitmap;
}