Archive for March, 2011
LibreOffice is the free power-packed Open Source personal productivity suite for Windows, Macintosh and Linux, that gives you six feature-rich applications for all your document production and data processing needs: Writer, Calc, Impress, Draw, Math and Base. Support and documentation is free from our large, dedicated community of users, contributors and developers. You, too, can also get involved!
I have never used it, but it looks promising.
Download LibreOffice.
Support the Red Cross disaster response in Japan
About the donations to Japan
Read more about this (http://www.ifrc.org/en/what-we-do/disaster-management/responding/ongoing-operations/japan-earthquake/about-the-donations-to-japan/).
Open the donation form (http://www.ifrc.org/en/get-involved/donate/donation/).
The software called “MarkMyImage” and it is a freeware.


Author says:
I wanted to watermark few sunset images taken by me, before posting it internet.
When I clicked checkboxes, froze the program. And I changed the source code on “frmMain.cs” so it works.
I commented out Reg. stuff, so that I did not want to use it.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using Microsoft.Win32;
namespace WaterMark
{
/// <summary>
/// Summary description for frmMain.
/// </summary>
public class frmMain : System.Windows.Forms.Form
{
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckedListBox lstFileList;
private System.Windows.Forms.TextBox txtWorkingFolder;
private System.Windows.Forms.ComboBox cmbImageType;
private System.Windows.Forms.PictureBox picSource;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button cmdBrowse1;
private System.Windows.Forms.Button cmdMake;
private System.Windows.Forms.CheckBox chkPreview;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Button cmdBrowse3;
private System.Windows.Forms.TextBox txtOutputFolder;
private System.Windows.Forms.CheckBox chkSameOutputFolder;
private System.Windows.Forms.TextBox txtSuffix;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lblAbout;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.LinkLabel linkLabel2;
private System.Windows.Forms.LinkLabel linkLabel3;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
//private const string RegKey = @"Software\Big Ds Tech\Mark My Image";
//private string regInputFolder, regOutputFolder,regWaterMarkImage;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.PictureBox picWaterMark;
private System.Windows.Forms.TextBox txtWaterMarkImage;
private System.Windows.Forms.Button cmdBrowse2;
private System.Windows.Forms.CheckBox chkWaterMarkImage;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtCopyRight;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.PropertyGrid propertyGrid1;
private WMProperties pt;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public frmMain()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lstFileList = new System.Windows.Forms.CheckedListBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.txtWaterMarkImage = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtCopyRight = new System.Windows.Forms.TextBox();
this.cmdBrowse2 = new System.Windows.Forms.Button();
this.chkWaterMarkImage = new System.Windows.Forms.CheckBox();
this.picWaterMark = new System.Windows.Forms.PictureBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.cmbImageType = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.cmdBrowse1 = new System.Windows.Forms.Button();
this.txtWorkingFolder = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.chkPreview = new System.Windows.Forms.CheckBox();
this.picSource = new System.Windows.Forms.PictureBox();
this.cmdMake = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.cmdBrowse3 = new System.Windows.Forms.Button();
this.txtOutputFolder = new System.Windows.Forms.TextBox();
this.chkSameOutputFolder = new System.Windows.Forms.CheckBox();
this.txtSuffix = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.lblAbout = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
this.linkLabel3 = new System.Windows.Forms.LinkLabel();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picWaterMark)).BeginInit();
this.tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picSource)).BeginInit();
this.SuspendLayout();
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 464);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel1,
this.statusBarPanel2});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(792, 18);
this.statusBar1.TabIndex = 0;
this.statusBar1.Text = "statusBar1";
//
// statusBarPanel1
//
this.statusBarPanel1.Name = "statusBarPanel1";
this.statusBarPanel1.Text = "Ready";
//
// statusBarPanel2
//
this.statusBarPanel2.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.statusBarPanel2.Name = "statusBarPanel2";
this.statusBarPanel2.Width = 675;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.lstFileList);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.cmbImageType);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.cmdBrowse1);
this.groupBox1.Controls.Add(this.txtWorkingFolder);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.chkPreview);
this.groupBox1.Location = new System.Drawing.Point(4, 2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(410, 458);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
//
// lstFileList
//
this.lstFileList.Location = new System.Drawing.Point(8, 76);
this.lstFileList.Name = "lstFileList";
this.lstFileList.Size = new System.Drawing.Size(396, 169);
this.lstFileList.TabIndex = 4;
this.lstFileList.SelectedIndexChanged += new System.EventHandler(this.lstFileList_SelectedIndexChanged);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.tabControl1);
this.groupBox2.Location = new System.Drawing.Point(6, 252);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(400, 200);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Water Mark";
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(6, 16);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(388, 178);
this.tabControl1.TabIndex = 13;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.txtWaterMarkImage);
this.tabPage1.Controls.Add(this.label4);
this.tabPage1.Controls.Add(this.txtCopyRight);
this.tabPage1.Controls.Add(this.cmdBrowse2);
this.tabPage1.Controls.Add(this.chkWaterMarkImage);
this.tabPage1.Controls.Add(this.picWaterMark);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(380, 152);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "General";
//
// txtWaterMarkImage
//
this.txtWaterMarkImage.Enabled = false;
this.txtWaterMarkImage.Location = new System.Drawing.Point(88, 68);
this.txtWaterMarkImage.Name = "txtWaterMarkImage";
this.txtWaterMarkImage.Size = new System.Drawing.Size(262, 20);
this.txtWaterMarkImage.TabIndex = 7;
//
// label4
//
this.label4.Location = new System.Drawing.Point(2, 6);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(84, 14);
this.label4.TabIndex = 12;
this.label4.Text = "Text";
//
// txtCopyRight
//
this.txtCopyRight.Location = new System.Drawing.Point(88, 6);
this.txtCopyRight.Multiline = true;
this.txtCopyRight.Name = "txtCopyRight";
this.txtCopyRight.Size = new System.Drawing.Size(288, 56);
this.txtCopyRight.TabIndex = 5;
this.txtCopyRight.Text = "Copyright © 2005 Big D";
//
// cmdBrowse2
//
this.cmdBrowse2.Enabled = false;
this.cmdBrowse2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.cmdBrowse2.Location = new System.Drawing.Point(354, 68);
this.cmdBrowse2.Name = "cmdBrowse2";
this.cmdBrowse2.Size = new System.Drawing.Size(22, 20);
this.cmdBrowse2.TabIndex = 8;
this.cmdBrowse2.Text = "...";
this.cmdBrowse2.Click += new System.EventHandler(this.cmdBrowse2_Click);
//
// chkWaterMarkImage
//
this.chkWaterMarkImage.Location = new System.Drawing.Point(2, 70);
this.chkWaterMarkImage.Name = "chkWaterMarkImage";
this.chkWaterMarkImage.Size = new System.Drawing.Size(84, 16);
this.chkWaterMarkImage.TabIndex = 6;
this.chkWaterMarkImage.Text = "Image";
this.chkWaterMarkImage.CheckedChanged += new System.EventHandler(this.chkWaterMarkImage_CheckedChanged);
//
// picWaterMark
//
this.picWaterMark.Location = new System.Drawing.Point(88, 94);
this.picWaterMark.Name = "picWaterMark";
this.picWaterMark.Size = new System.Drawing.Size(290, 54);
this.picWaterMark.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.picWaterMark.TabIndex = 11;
this.picWaterMark.TabStop = false;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.propertyGrid1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(380, 152);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Properties";
//
// propertyGrid1
//
this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyGrid1.HelpVisible = false;
this.propertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar;
this.propertyGrid1.Location = new System.Drawing.Point(0, 0);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.Size = new System.Drawing.Size(380, 152);
this.propertyGrid1.TabIndex = 0;
this.propertyGrid1.ToolbarVisible = false;
//
// cmbImageType
//
this.cmbImageType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbImageType.Items.AddRange(new object[] {
"All Image Files",
"JPEG Images (*.JPG, *.JPEG)",
"Windows Bitmap Images (*.bmp)"});
this.cmbImageType.Location = new System.Drawing.Point(104, 46);
this.cmbImageType.Name = "cmbImageType";
this.cmbImageType.Size = new System.Drawing.Size(176, 21);
this.cmbImageType.TabIndex = 2;
this.cmbImageType.SelectedIndexChanged += new System.EventHandler(this.cmbImageType_SelectedIndexChanged);
//
// label3
//
this.label3.Location = new System.Drawing.Point(10, 50);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(82, 14);
this.label3.TabIndex = 6;
this.label3.Text = "Image Type";
//
// cmdBrowse1
//
this.cmdBrowse1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.cmdBrowse1.Location = new System.Drawing.Point(382, 20);
this.cmdBrowse1.Name = "cmdBrowse1";
this.cmdBrowse1.Size = new System.Drawing.Size(22, 20);
this.cmdBrowse1.TabIndex = 1;
this.cmdBrowse1.Text = "...";
this.cmdBrowse1.Click += new System.EventHandler(this.cmdBrowse1_Click);
//
// txtWorkingFolder
//
this.txtWorkingFolder.Location = new System.Drawing.Point(104, 20);
this.txtWorkingFolder.Name = "txtWorkingFolder";
this.txtWorkingFolder.Size = new System.Drawing.Size(274, 20);
this.txtWorkingFolder.TabIndex = 0;
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(94, 14);
this.label1.TabIndex = 0;
this.label1.Text = "Input Folder";
//
// chkPreview
//
this.chkPreview.Checked = true;
this.chkPreview.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkPreview.Location = new System.Drawing.Point(284, 48);
this.chkPreview.Name = "chkPreview";
this.chkPreview.Size = new System.Drawing.Size(120, 20);
this.chkPreview.TabIndex = 3;
this.chkPreview.Text = "&Preview Image";
this.chkPreview.CheckedChanged += new System.EventHandler(this.chkPreview_CheckedChanged);
//
// picSource
//
this.picSource.Location = new System.Drawing.Point(418, 6);
this.picSource.Name = "picSource";
this.picSource.Size = new System.Drawing.Size(370, 228);
this.picSource.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picSource.TabIndex = 2;
this.picSource.TabStop = false;
//
// cmdMake
//
this.cmdMake.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.cmdMake.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmdMake.Location = new System.Drawing.Point(418, 326);
this.cmdMake.Name = "cmdMake";
this.cmdMake.Size = new System.Drawing.Size(370, 32);
this.cmdMake.TabIndex = 12;
this.cmdMake.Text = "&Make";
this.cmdMake.Click += new System.EventHandler(this.cmdMake_Click);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(416, 238);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(372, 22);
this.progressBar1.TabIndex = 14;
//
// cmdBrowse3
//
this.cmdBrowse3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.cmdBrowse3.Location = new System.Drawing.Point(764, 296);
this.cmdBrowse3.Name = "cmdBrowse3";
this.cmdBrowse3.Size = new System.Drawing.Size(22, 20);
this.cmdBrowse3.TabIndex = 11;
this.cmdBrowse3.Text = "...";
this.cmdBrowse3.Click += new System.EventHandler(this.cmdBrowse3_Click);
//
// txtOutputFolder
//
this.txtOutputFolder.Location = new System.Drawing.Point(418, 296);
this.txtOutputFolder.Name = "txtOutputFolder";
this.txtOutputFolder.Size = new System.Drawing.Size(342, 20);
this.txtOutputFolder.TabIndex = 10;
//
// chkSameOutputFolder
//
this.chkSameOutputFolder.BackColor = System.Drawing.SystemColors.Control;
this.chkSameOutputFolder.Checked = true;
this.chkSameOutputFolder.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkSameOutputFolder.Location = new System.Drawing.Point(420, 270);
this.chkSameOutputFolder.Name = "chkSameOutputFolder";
this.chkSameOutputFolder.Size = new System.Drawing.Size(242, 18);
this.chkSameOutputFolder.TabIndex = 9;
this.chkSameOutputFolder.Text = "Use &output folder as same add suffix";
this.chkSameOutputFolder.UseVisualStyleBackColor = false;
this.chkSameOutputFolder.CheckedChanged += new System.EventHandler(this.chkSameOutputFolder_CheckedChanged);
//
// txtSuffix
//
this.txtSuffix.Location = new System.Drawing.Point(620, 267);
this.txtSuffix.MaxLength = 15;
this.txtSuffix.Name = "txtSuffix";
this.txtSuffix.Size = new System.Drawing.Size(50, 20);
this.txtSuffix.TabIndex = 19;
this.txtSuffix.Text = "_final";
//
// label2
//
this.label2.Location = new System.Drawing.Point(676, 271);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(82, 16);
this.label2.TabIndex = 20;
this.label2.Text = "after file names";
//
// lblAbout
//
this.lblAbout.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblAbout.Location = new System.Drawing.Point(416, 364);
this.lblAbout.Name = "lblAbout";
this.lblAbout.Size = new System.Drawing.Size(372, 96);
this.lblAbout.TabIndex = 21;
this.lblAbout.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label5
//
this.label5.Location = new System.Drawing.Point(420, 382);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(368, 14);
this.label5.TabIndex = 22;
this.label5.Text = "Developed by Deb\'jyoti Das";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label6
//
this.label6.Location = new System.Drawing.Point(420, 422);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(356, 14);
this.label6.TabIndex = 23;
this.label6.Text = "Main credit goes to Joel Neubeck\'s this Code Project article ";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// linkLabel1
//
this.linkLabel1.Location = new System.Drawing.Point(588, 400);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(182, 18);
this.linkLabel1.TabIndex = 24;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "http://b.domaindlx.com/bigd";
this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// linkLabel2
//
this.linkLabel2.Location = new System.Drawing.Point(446, 400);
this.linkLabel2.Name = "linkLabel2";
this.linkLabel2.Size = new System.Drawing.Size(146, 18);
this.linkLabel2.TabIndex = 25;
this.linkLabel2.TabStop = true;
this.linkLabel2.Text = "invincible.bigd@gmail.com";
this.linkLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
//
// linkLabel3
//
this.linkLabel3.Location = new System.Drawing.Point(624, 422);
this.linkLabel3.Name = "linkLabel3";
this.linkLabel3.Size = new System.Drawing.Size(22, 14);
this.linkLabel3.TabIndex = 26;
this.linkLabel3.TabStop = true;
this.linkLabel3.Text = "this";
this.linkLabel3.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
//
// frmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(792, 482);
this.Controls.Add(this.linkLabel3);
this.Controls.Add(this.linkLabel2);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.lblAbout);
this.Controls.Add(this.label2);
this.Controls.Add(this.txtSuffix);
this.Controls.Add(this.chkSameOutputFolder);
this.Controls.Add(this.txtOutputFolder);
this.Controls.Add(this.cmdBrowse3);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.picSource);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.cmdMake);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "frmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Mark My Image";
this.Load += new System.EventHandler(this.frmMain_Load);
this.Closed += new System.EventHandler(this.frmMain_Closed);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picWaterMark)).EndInit();
this.tabPage2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new frmMain());
}
private void frmMain_Load(object sender, System.EventArgs e)
{
pt = new WMProperties();
//GetFromRegistry();
//txtWorkingFolder.Text = regInputFolder;
//txtWaterMarkImage.Text = regWaterMarkImage;
chkWaterMarkImage.Checked = false;
cmbImageType.SelectedIndex = 0;
//txtOutputFolder.Text = regOutputFolder;
txtOutputFolder.Enabled = false;
cmdBrowse3.Enabled = false;
setWMProperties();
//pt.TextPosition = ContentAlignment.BottomCenter;
//pt.ImagePosition = ContentAlignment.TopRight;
//pt.Font = new Font("arial",(float)8.25);
//pt.FontSizeBestFit = true;
//lblAbout.Text = ";
pt.setDefaultValues();
GetFiles();
if(chkPreview.Checked == true && lstFileList.Items.Count > 0)
{
lstFileList.SelectedIndex = 0;
if (File.Exists(lstFileList.Items[0].ToString()))
picSource.Image = Image.FromFile(lstFileList.Items[0].ToString());
}
}
private void GetFiles()
{
string [] temp1 = null,temp2 = null,temp3 = null,fileEntries = null;
int tot_files = 0;
try
{
switch(cmbImageType.SelectedIndex)
{
case 0:
temp1 = Directory.GetFiles(txtWorkingFolder.Text,"*.jpg");
temp2 = Directory.GetFiles(txtWorkingFolder.Text,"*.jpeg");
temp3 = Directory.GetFiles(txtWorkingFolder.Text,"*.bmp");
tot_files = temp1.Length + temp2.Length + temp3.Length;
fileEntries = new string[tot_files];
Array.Copy(temp1,0,fileEntries,0,temp1.Length);
Array.Copy(temp2,0,fileEntries,temp1.Length,temp2.Length);
Array.Copy(temp3,0,fileEntries,temp1.Length + temp2.Length,temp3.Length);
break;
case 1:
temp1 = Directory.GetFiles(txtWorkingFolder.Text,"*.jpg");
temp2 = Directory.GetFiles(txtWorkingFolder.Text,"*.jpeg");
tot_files = temp1.Length + temp2.Length;
fileEntries = new string[tot_files];
Array.Copy(temp1,0,fileEntries,0,temp1.Length);
Array.Copy(temp2,0,fileEntries,fileEntries.Length,temp2.Length);
break;
case 2:
fileEntries = Directory.GetFiles(txtWorkingFolder.Text,"*.bmp");
tot_files = fileEntries.Length;
break;
}
progressBar1.Maximum = tot_files;
lstFileList.Items.Clear();
foreach(string fileName in fileEntries)
{
if (fileName != null)
lstFileList.Items.Add(fileName.Replace(AppDomain.CurrentDomain.BaseDirectory,@".\"),CheckState.Checked);
}
statusBarPanel2.Text = lstFileList.Items.Count + " File(s)" ;
//We will add the preview item..
//lstPreview.Items.Add("Preview using current Watermark settings");
}
catch{}
}
private void cmdBrowse1_Click(object sender, System.EventArgs e)
{
string oldWorkingFolder;
try
{
if(txtWorkingFolder.Text.Substring(0,1) == ".")
oldWorkingFolder = txtWorkingFolder.Text.Replace(".",AppDomain.CurrentDomain.BaseDirectory.Substring(0,AppDomain.CurrentDomain.BaseDirectory.Length - 1));
else
oldWorkingFolder = txtWorkingFolder.Text;
folderBrowserDialog1.SelectedPath = oldWorkingFolder;
//folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.Personal;
}
catch{}
try
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
txtWorkingFolder.Text = folderBrowserDialog1.SelectedPath;
if (chkSameOutputFolder.Checked == true)
{
txtOutputFolder.Text = txtWorkingFolder.Text;
}
GetFiles();
}
}
catch{}
}
private void chkWaterMarkImage_CheckedChanged(object sender, System.EventArgs e)
{
//if(chkWaterMarkImage.Checked == true && txtWaterMarkImage.Text != "")
if (chkWaterMarkImage.Checked == true)
{
txtWaterMarkImage.Enabled = true;
cmdBrowse2.Enabled = true;
string fileName;
if (txtWaterMarkImage.Text != "")
{
if(txtWaterMarkImage.Text.Substring(0,1) == ".")
fileName = AppDomain.CurrentDomain.BaseDirectory + txtWaterMarkImage.Text.Substring(2);
else
fileName = txtWaterMarkImage.Text;
if(File.Exists(fileName))
{
picWaterMark.Image = Image.FromFile(fileName);
}
}
}
else
{
txtWaterMarkImage.Enabled = false;
cmdBrowse2.Enabled = false;
picWaterMark.Image = null;
pt.CopyrightImage = null;
}
}
private void lstFileList_SelectedIndexChanged(object sender, System.EventArgs e)
{
string filename= txtWorkingFolder.Text + lstFileList.SelectedItem.ToString().Substring(lstFileList.SelectedItem.ToString().LastIndexOf("\\"));
if(chkPreview.Checked == true && File.Exists(filename))
{
picSource.Image = Image.FromFile(filename);
}
}
private void cmdMake_Click(object sender, System.EventArgs e)
{
if ( chkSameOutputFolder.Checked == false && txtWorkingFolder.Text.Equals(txtOutputFolder.Text))
{
MessageBox.Show("Output folder can not be same as input folder",this.Text,MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
try
{
this.Cursor = Cursors.WaitCursor;
statusBarPanel1.Text = "Busy";
Application.DoEvents();
WaterMark wm;
string srcPic,dstPic;
if (chkWaterMarkImage.Checked == true)
wm = new WaterMark(txtWorkingFolder.Text,txtCopyRight.Text,pt.TextPosition,pt.Font,picWaterMark.Image,pt.ImagePosition);
else
wm = new WaterMark(txtWorkingFolder.Text,txtCopyRight.Text,pt.TextPosition,pt.Font);
for(int i=0;i<lstFileList.CheckedItems.Count;i++)
{
//srcPic = txtWorkingFolder.Text + lstFileList.Items[i].ToString().Substring(1);
srcPic = txtWorkingFolder.Text + lstFileList.Items[i].ToString().Substring(lstFileList.Items[i].ToString().LastIndexOf("\\"));
if (chkSameOutputFolder.Checked == true)
dstPic = srcPic.Insert(srcPic.LastIndexOf("."),txtSuffix.Text);
else
dstPic = txtOutputFolder.Text + "\\" + srcPic.Substring(srcPic.LastIndexOf("\\") + 1);
wm.MarkImage(srcPic,dstPic);
progressBar1.Increment(1);
statusBarPanel2.Text = "Proecessing Image " + srcPic.Substring(lstFileList.Items[i].ToString().LastIndexOf("\\") + 1);
Application.DoEvents();
}
progressBar1.Value = 0;
statusBarPanel1.Text = "Ready";
statusBarPanel2.Text = "";
this.Cursor = Cursors.Default;
Application.DoEvents();
}
catch(Exception ex)
{
progressBar1.Value = 0;
statusBarPanel1.Text = "Ready";
statusBarPanel2.Text = ex.Message;
this.Cursor = Cursors.Default;
Application.DoEvents();
}
}
private void chkSameOutputFolder_CheckedChanged(object sender, System.EventArgs e)
{
if (chkSameOutputFolder.Checked == true)
{
chkSameOutputFolder.Text = "Use &output folder as same add suffix";
chkSameOutputFolder.Width = 306;
chkSameOutputFolder.SendToBack();
txtOutputFolder.Text = txtWorkingFolder.Text;
txtOutputFolder.Enabled = false;
cmdBrowse3.Enabled = false;
txtSuffix.Visible = true;
}
else
{
chkSameOutputFolder.Text = "Use following &output folder and keep same file name(s)";
chkSameOutputFolder.Width = cmdMake.Width;
chkSameOutputFolder.BringToFront();
//txtOutputFolder.Text = regOutputFolder;
txtOutputFolder.Enabled = true;
cmdBrowse3.Enabled = true;
txtSuffix.Visible = false;
}
}
private void linkLabel2_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("mailto:" + linkLabel2.Text + "?subject=MarkMyImage@Codeproject.com");
}
private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(linkLabel1.Text);
}
private void linkLabel3_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://www.codeproject.com/csharp/watermark.asp");
}
private void chkPreview_CheckedChanged(object sender, System.EventArgs e)
{
try
{
if (chkPreview.Checked == false)
picSource.Image = null;
else
picSource.Image = Image.FromFile(txtWorkingFolder.Text + lstFileList.SelectedItem.ToString().Substring(1));
}
catch{}
}
private void cmbImageType_SelectedIndexChanged(object sender, System.EventArgs e)
{
GetFiles();
}
private void cmdBrowse3_Click(object sender, System.EventArgs e)
{
string oldInputFolder;
try
{
if(txtOutputFolder.Text.Substring(0,1) == ".")
oldInputFolder = txtOutputFolder.Text.Replace(".",AppDomain.CurrentDomain.BaseDirectory.Substring(0,AppDomain.CurrentDomain.BaseDirectory.Length - 1));
else
oldInputFolder = txtOutputFolder.Text;
folderBrowserDialog1.SelectedPath = oldInputFolder;
//folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.Personal;
}
catch{}
try
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
if (txtWorkingFolder.Text == folderBrowserDialog1.SelectedPath)
MessageBox.Show("Input and output folder can not be same",this.Text,MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
else
txtOutputFolder.Text = folderBrowserDialog1.SelectedPath;
}
}
catch{}
}
/*
private void SaveToRegistry()
{
RegistryKey myKey = Registry.CurrentUser.CreateSubKey(RegKey);
myKey.SetValue("InputFolder",txtWorkingFolder.Text);
myKey.SetValue("OutputFolder",txtOutputFolder.Text);
myKey.SetValue("WaterMarkImage",txtWaterMarkImage.Text);
}
private void GetFromRegistry()
{
try
{
RegistryKey mykey = Registry.CurrentUser.OpenSubKey(RegKey);
regInputFolder = mykey.GetValue("InputFolder").ToString();
regOutputFolder = mykey.GetValue("OutputFolder").ToString();
regWaterMarkImage = mykey.GetValue("WaterMarkImage").ToString();
}
catch
{
MessageBox.Show(this.Text + " is not installed properly, or it corrupt. Please re-install and try again.",this.Text,MessageBoxButtons.OK,MessageBoxIcon.Stop);
Application.Exit();
}
}
*/
private void frmMain_Closed(object sender, System.EventArgs e)
{
//SaveToRegistry();
}
private void cmdBrowse2_Click(object sender, System.EventArgs e)
{
openFileDialog1.Filter = "All Picture Files|*.jpg;*.bmp|JPEG(*.JPEG,*JPG)|*.jpg;*.jpeg|Bitmap Files(*.BMP)|*.bmp|All Files|*.*";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
txtWaterMarkImage.Text = openFileDialog1.FileName;
picWaterMark.Image = Image.FromFile(txtWaterMarkImage.Text);
}
}
private void setWMProperties()
{
pt.CopyrightText = txtCopyRight.Text;
if (chkWaterMarkImage.Checked == true)
{
pt.CopyrightImage = picWaterMark.Image ;
}
propertyGrid1.SelectedObject = pt;
}
private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (tabControl1.SelectedIndex == 1) setWMProperties();
}
}
}
You will find his homepage here (http://b.domaindlx.com/bigd)