// Resim Imzalama | www.aliakyildirim.com | Ali AKYILDIRIM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net.Sockets;
// Resim Imzalama | www.aliakyildirim.com | Ali AKYILDIRIM
namespace StreamKavrami
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// www.aliakyildirim.com
}
private void btnGozat_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "JPG Dosyalari|*.JPG|PNG Dosyalari|*.png";
if (ofd.ShowDialog() == DialogResult.OK)
{
txtGozat.Text = ofd.FileName;
pictureBox1.ImageLocation = ofd.FileName;
}
}
private void btnYazdir_Click(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(pictureBox1.Image);
Graphics g = Graphics.FromImage(bmp);
// Eklenecek imzanin yazi fontu ve rengini degistirebilirsiniz..
g.DrawString(txtYazdir.Text, new Font("Verdana", 12, GraphicsUnit.Pixel), Brushes.White, bmp.Width - (txtYazdir.TextLength + 150), bmp.Height - 30);
string s = Path.GetDirectoryName(txtGozat.Text);
FileStream fs = new FileStream(s + "\\" + "imzali.jpg", FileMode.Create);
bmp.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
fs.Close(); //Resimle isimiz bittigi için kapatiyoruz:
g.Dispose();
bmp.Dispose();
btnYazdir.Enabled = false;
lblSonuc.Text = "Islem Tamamlandi..!";
}
}
}
// Resim Imzalama | www.aliakyildirim.com | Ali AKYILDIRIM
Kaynak: Bu Örnek, Bilge Adam egitimi Sirasinda Türkay Ürkmez Tarafindan Yapilmis ve Yazilimcik.com ailesi tarafindan gelistirilmistir.