using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Drawing.Printing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
public class Form1 : Form {
protected override void OnPaint(PaintEventArgs e) {
Bitmap bmp = new Bitmap("alphabet.gif");
Graphics g = e.Graphics;
float[][] matrixItems = {
new float[] {0.2f, 0, 0, 0, 0},
new float[] {0, 0.8f, 0, 0, 0},
new float[] {0, 0, 1, 0, 0},
new float[] {0, 0, 0, 1, 0},
new float[] {0, 0, 0, 0, 1}};
ColorMatrix colorMatrix = new ColorMatrix(matrixItems);
ImageAttributes imageAtt = new ImageAttributes();
imageAtt.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
TextureBrush tb = new TextureBrush(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), imageAtt);
tb.WrapMode = WrapMode.Tile;
g.FillRectangle(tb, this.ClientRectangle);
bmp.Dispose();
tb.Dispose();
}
public static void Main() {
Application.Run(new Form1());
}
}
|