using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class MainForm : Form {
private Brush texturedTextBrush;
private Brush texturedBGroundBrush;
public MainForm() {
Image bGroundBrushImage = new Bitmap("Clouds.bmp");
texturedBGroundBrush = new TextureBrush(bGroundBrushImage);
Image textBrushImage = new Bitmap("Soap Bubbles.bmp");
texturedTextBrush = new TextureBrush(textBrushImage);
}
protected void OnPaint(PaintEventArgs e) {
Graphics g = e.Graphics;
Rectangle r = ClientRectangle;
g.FillRectangle(texturedBGroundBrush, r);
g.DrawString("Bitmaps as brushes",
new Font("Arial", 30,
FontStyle.Bold | FontStyle.Italic),
texturedTextBrush,
r);
}
public static void Main(){
Application.Run(new MainForm());
}
}
|