Add a handler for the Click event of the 'Fast' menu
item:
private
void
fastToolStripMenuItem_Click(object
sender, EventArgs
e)
{
if
(pictureBox.Image !=
null)
{
Bitmap
bmp = new
Bitmap(pictureBox.Image);
Graphics
g = Graphics.FromImage(bmp);
ColorMatrix
colorMatrix = new
ColorMatrix(new
float[][]
{
new
float[]
{.299f, .299f, .299f, 0, 0},
new
float[]
{.587f, .587f, .587f, 0, 0},
new
float[]
{.114f, .114f, .114f, 0, 0},
new
float[]
{0, 0, 0, 1, 0},
new
float[]
{0, 0, 0, 0, 1}
});
ImageAttributes
attributes = new
ImageAttributes();
attributes.SetColorMatrix(colorMatrix);
g.DrawImage(pictureBox.Image,
new
Rectangle(0,
0, pictureBox.Image.Width, pictureBox.Image.Height),
0, 0, pictureBox.Image.Width,
pictureBox.Image.Height,
GraphicsUnit.Pixel,
attributes);
g.Dispose();
pictureBox.Image
= bmp;
}
}