, Visual C#



67.1. , .

private void pictureBox1_Paint(object sender,

PaintEventArgs e)

{

// ,

// :

Bitmap myBitmap = new Bitmap(150, 150,

PixelFormat.Format32bppArgb);

 

Graphics g = Graphics.FromImage(myBitmap);

g.FillRectangle(new SolidBrush(Color.FromArgb(255,

128, 128, 128)), new Rectangle(0, 0, 150, 150));

myBitmap.Save("Rectangle1.jpg");

 

//

// :

Image myImage =

Image.FromFile("Rectangle1.jpg");

e.Graphics.DrawImage(myImage, 20, 20);

 

//

// myColorMatrix ColorMatrix:

ColorMatrix myColorMatrix = new ColorMatrix();

 

myColorMatrix.Matrix00 = 1.7F; // Red

myColorMatrix.Matrix11 = 1; // Green

myColorMatrix.Matrix22 = 1; // Blue

myColorMatrix.Matrix33 = 1; // alpha

myColorMatrix.Matrix44 = 1; // w

 

// myImageAttributes

// ImageAttributes:

ImageAttributes myImageAttributes =

new ImageAttributes();

 

// myColorMatrix

// :

myImageAttributes.SetColorMatrix(myColorMatrix);

// :

Rectangle myRectangle2 = new Rectangle(200, 20,

200, 200);

 

// ,

// myColorMatrix:

e.Graphics.DrawImage(myImage, myRectangle2, 0, 0,

200, 200, GraphicsUnit.Pixel, myImageAttributes);

}

Form1.cs :

using System.Drawing.Imaging;

(Ctrl+F5) Form1 , () , ( myColorMatrix.Matrix00 = 1.7F;) 1.7 (. 67.1).