void MnuBoxClick(object sender, System.EventArgs e) { if (this.selectedImage == null) return; frmBF bfDLG = new frmBF(); bfDLG.BoxFilterProp = Effects.BoxFilter; DialogResult result = bfDLG.ShowDialog(); if (result == DialogResult.OK && bfDLG.BoxFilterProp.Angle != 0 && bfDLG.BoxFilterProp.BoxDepth !=0) { Effects.BoxFilter = bfDLG.BoxFilterProp; Bitmap oldImg = this.SelectedImage; this.selectedImage = Effects.Box(this.SelectedImage); oldImg.Dispose(); this.picBoxMain.Invalidate(); bfDLG.Dispose(); // Gargabge Collection System.GC.Collect(); } }
private void btnBoxFilter_Click(object sender, EventArgs e) { frmBF bf = new frmBF(); bf.BoxFilterProp = Effects2.BoxFilter; DialogResult res = bf.ShowDialog(); Application.DoEvents(); if (res != DialogResult.OK) return; Application.DoEvents(); if (Program.Photo != null) { try { undoHelper.BoxFilter = Effects2.BoxFilter; Effects2.BoxFilter = bf.BoxFilterProp; FilterEffects(); } catch { } } }