zoukankan      html  css  js  c++  java
  • C#如何将文本图片内容画到Bitmap上面去

            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; }
  • 相关阅读:
    函数作业1
    函数、装饰器、迭代器、内置方法总练习题
    疑问
    装饰器
    文件练习题1,2
    内置函数练习题和总结
    GET和POST请求的区别
    HTTP请求方法
    HTTP之状态码
    HTTP之响应消息Response
  • 原文地址:https://www.cnblogs.com/linfenghp/p/14683554.html
Copyright © 2011-2022 走看看