private void button3_Click(object sender, EventArgs e) { Graphics g = this.CreateGraphics(); int x = 0; int y = 0; int width = this.ClientRectangle.Width; int height = this.ClientRectangle.Height / 5; Brush whiteBrush = System.Drawing.Brushes.White; Brush blackBrush = System.Drawing.Brushes.Black; using (Brush brush = new SolidBrush(Color.DarkBlue)) { g.FillRectangle(brush, x, y, width, height); g.DrawString(brush.ToString(), this.Font, whiteBrush, x, y); y += height; } string file = @"E:\document\My Pictures\mine\俄罗斯方块_图标_16.bmp"; using (Brush brush = new TextureBrush(new Bitmap(file))) { g.FillRectangle(brush, x, y, width, height); g.DrawString(brush.ToString(), this.Font, whiteBrush, x, y); y += height; } using (Brush brush = new HatchBrush( HatchStyle.Divot, Color.DarkBlue, Color.White)) { g.FillRectangle(brush, x, y, width, height); g.DrawString(brush.ToString(), this.Font, blackBrush, x, y); y += height; } using (Brush brush = new LinearGradientBrush( new Rectangle(x, y, width, height), Color.DarkBlue, Color.White, 45.0f)) { g.FillRectangle(brush, x, y, width, height); g.DrawString(brush.ToString(), this.Font, blackBrush, x, y); y += height; } Point[] points = new Point[] { new Point(x, y), new Point(x + width, y), new Point(x + width, y + height), new Point(x, y + height) }; using (Brush brush = new PathGradientBrush(points)) { g.FillRectangle(brush, x, y, width, height); g.DrawString(brush.ToString(), this.Font, blackBrush, x, y); y += height; } }