Пример #1
0
        /// <summary>
        /// 将印章盖在原图片上
        /// </summary>
        /// <param name="sourceImg">源图片.</param>
        /// <param name="company">公司名字</param>
        /// <param name="department">部门名字</param>
        /// <param name="isTransparent">图片保存路径</param>
        public static void StampSealOnImage(Bitmap sourceImg, string company, string department, bool isTransparent = false)
        {
            Bitmap   bmpSeal = CreatPublicSeal.GetSealBitmap(company, department, isTransparent);
            Graphics g       = Graphics.FromImage(sourceImg);

            g.DrawImage(bmpSeal, sourceImg.Width - bmpSeal.Width - 30, sourceImg.Height - bmpSeal.Height - 30, bmpSeal.Width, bmpSeal.Height);
            g.Dispose();
        }
Пример #2
0
        /// <summary>
        /// Handles the Click event of the button1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void button1_Click(object sender, EventArgs e)
        {
            string signaturePicPath = @"E:/" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".jpg";
            Bitmap bmp = new Bitmap(@"bg.jpg");

            CreatPublicSeal.StampSealOnImage(bmp, "温江区指挥党建网络党组织关系转接", "专用章", true);
            //bmp.Save(signaturePicPath);
            this.pictureBox1.Image = bmp;
        }
Пример #3
0
        /// <summary>
        /// 印章的中间部分根据图片加载而来.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void button3_Click(object sender, EventArgs e)
        {
            this.pictureBox1.Image = null;
            // 公章的图片
            string sealImageUrl = string.Empty;
            // 原图片地址
            string sourceUrl      = string.Empty;
            string locationWidth  = string.Empty;
            string locationHeight = string.Empty;

            Bitmap bmp = CreatPublicSeal.GetSealByLoadCenterPic(@"./seal.png", 30, 30, "深圳市腾讯计算机公司", "财务章", true);

            //bmp.Save(signaturePicPath);
            this.pictureBox1.Image = bmp;
        }
Пример #4
0
 /// <summary>
 /// 读取图片生成印章
 /// </summary>
 /// <param name="centerImgStr">中间图片路径.</param>
 /// <param name="width">指定图片显示宽度.如果≤0,则取图片的宽度</param>
 /// <param name="height">指定图片显示高度.如果≤0,则取图片的宽度</param>
 /// <param name="company">公司名字</param>
 /// <param name="department">部门名字</param>
 /// <param name="isTransparent">图片保存路径</param>
 public static Bitmap GetSealByLoadCenterPic(string centerImgStr, float width, float height, string company, string department, bool isTransparent = false)
 {
     return(CreatPublicSeal.CreatSealByLoadCenterPic(centerImgStr, width, height, company, department, true));
 }