基本信息
源码名称:Graphics 绘制窗体 示例源码
源码大小:0.26M
文件格式:.rar
开发语言:C#
更新时间:2018-05-09
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

自动产生包含个人讯息之识别证图片


 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)
        {
           

        }

        private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
           
        }

        private void Form1_Paint_1(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Bitmap bmp = new Bitmap("Test.jpg");
            //g.FromImage(bmp);
           
            g.DrawImage(bmp, 0, 0);

           
            Font fn = new Font("Tahoma", 24, FontStyle.Regular);

            Font fn1 = new Font("Tahoma", 8, FontStyle.Regular);

            //g.Clear(Color.Honeydew);
            g.DrawString("管理部", fn, Brushes.Black, new PointF(550, 250));
            g.DrawString("資訊工程師", fn, Brushes.Black, new PointF(550, 350));
            g.DrawString("A君", fn, Brushes.Black, new PointF(550, 450));
            g.DrawString("A君英文名", fn, Brushes.Black, new PointF(550, 540));
            //g.DrawString("其它資訊", fn1, Brushes.Black, new PointF(80, 80));
            //g.DrawString("地址:", fn1, Brushes.Black, new PointF(5, 115));
            //g.DrawString("中清路....", fn1, Brushes.Black, new PointF(40, 115));
            //g.DrawString("电话:", fn1, Brushes.Black, new PointF(5, 130));
            //g.DrawString("0982.......", fn1, Brushes.Black, new PointF(40, 130));
            //g.DrawString("QQ:", fn1, Brushes.Black, new PointF(5, 145));
            //g.DrawString("53453456", fn1, Brushes.Black, new PointF(40, 145));
            g.DrawString("MSN:", fn1, Brushes.Black, new PointF(120, 145));
            g.DrawString("xxxx@hotmail.com", fn1, Brushes.Black, new PointF(155, 145));
            g.DrawString("邮编:", fn1, Brushes.Black, new PointF(5, 160));
            g.DrawString("43646", fn1, Brushes.Black, new PointF(40, 160));
            g.DrawString("Email:", fn1, Brushes.Black, new PointF(120, 160));
            g.DrawString("xxxx@yahoo.com.tw", fn1, Brushes.Black, new PointF(155, 160));

            g.DrawLine(new Pen(Color.Blue, 2), 0, 110, 300, 110);

            //释放图像缓存
            g.Dispose();

            //图片自动保存路径
            string dirpath = Application.StartupPath;
            dirpath = dirpath "\\TempImage";

            if (!System.IO.Directory.Exists(dirpath))
            {
                System.IO.Directory.CreateDirectory(dirpath);
            }

            string filePath = dirpath "//LinkMan1.jpg";
            bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
            //释放位图缓存
            bmp.Dispose();

        }


    }
}