111,125
社区成员
发帖
与我相关
我的任务
分享using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Bitmap bmp = new Bitmap("D:\\VclLib\\GdiplusDemo\\Media\\msn1.gif");
float[][] matrixItams =
{
new float[] {0.3f, 0.3f, 0.3f, 0.0f, 0.0f},
new float[] {0.59f, 0.59f, 0.59f, 0.0f, 0.0f},
new float[] {0.11f, 0.11f, 0.11f, 0.0f, 0.0f},
new float[] {0.0f, 0.0f, 0.0f, 1.0f, 0.0f},
new float[] {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}
};
ColorMatrix cMatrix = new ColorMatrix(matrixItams);
ImageAttributes attr = new ImageAttributes();
attr.SetColorMatrix(cMatrix);
e.Graphics.DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, attr);
}
}
}