| this.btn_Water, this.button2, this.btn_Browser, this.groupBox1, this.groupBox2, this.label2}); this.Name = "Form1"; this.Text = "Form1"; this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.ResumeLayout(false); } #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void btn_Browser_Click(object sender, System.EventArgs e) { using(OpenFileDialog dlg = new OpenFileDialog()) { if(dlg.ShowDialog() == DialogResult.OK) { string file = dlg.FileName; if(File.Exists(file)) { this.SourceFile = file; imgSource.Image = new Bitmap(file); } } dlg.Dispose(); } } private void button2_Click(object sender, System.EventArgs e) { string wf = @"E:\Test.jpg"; this.SaveFile = wf; int local = (int)(this.local.SelectedValue); int al = 80; try { al = Int32.Parse(this.alpha.Text.Trim()); } catch { } if(MakeWaterImage(this.SourceFile,this.WaterFile,this.SaveFile,local,al)) { this.imgObject.Image = new Bitmap(this.SaveFile); } } |