MainForm.cs
上传用户:linger1010
上传日期:2008-12-08
资源大小:561k
文件大小:1k
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace UsingBrush
- {
- public partial class MainForm : Form
- {
- public MainForm()
- {
- InitializeComponent();
- }
- private void MainForm_Paint(object sender, PaintEventArgs e)
- {
- // 构造一个实心画刷
- SolidBrush sb = new SolidBrush(Color.Green);
- // 填充一个矩形
- e.Graphics.FillRectangle(sb, 10, 10, 210, 160);
- // 释放画刷
- sb.Dispose();
- // 构造一个纹理画刷并用其填充一个矩形
- using(TextureBrush tb = new TextureBrush(Properties.Resources.Bitmap))
- {
- e.Graphics.FillRectangle(tb, 10, 220, 210, 160);
- }
- }
- }
- }