|
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 Erik.Utilities;
using Erik.Utilities.Interfaces;
using Erik.Utilities.Bases;
namespace OneThreadSamples
{
public partial class frmMain : Form
{
Bitmap _bmp;
public frmMain()
{
InitializeComponent();
}
private void mnuEffects_DropDownOpening(object sender, EventArgs e)
{
bool enable = pct.Image != null;
foreach (ToolStripItem itm in mnuEffects.DropDownItems)
itm.Enabled = enable;
}
private void mnuFileExit_Click(object sender, EventArgs e)
{
Close();
}
private void mnuFileOpen_Click(object sender, EventArgs e)
{
if (dlg.ShowDialog() == DialogResult.OK)
{
try
{
_bmp = Bitmap.FromFile(dlg.FileName) as Bitmap;
pct.Image = _bmp;
}
catch
{
MessageBox.Show(this, "The file is not a valid Bitmap",
"Problem", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void mnuEffectsNegative_Click(object sender, EventArgs e)
{
Lib.StartProgressiveOperation(new NegativePO(_bmp), this);
pct.Refresh();
}
private void mnuEffectsGray_Click(object sender, EventArgs e)
{
Lib.StartProgressiveOperation(new GrayScalePO(_bmp), this);
pct.Refresh();
}
private void mnuEffectsAllEffects_Click(object sender, EventArgs e)
{
List<IProgressiveOperation> opList = new List<IProgressiveOperation>();
opList.Add(new NegativePO(_bmp));
opList.Add(new GrayScalePO(_bmp));
Lib.StartProgressiveOperation(new CompositePO(opList), this);
pct.Refresh();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.