public FillRectangle ( |
||
brush | ||
rect | ||
return | void |
Rectangle rect = new Rectangle(10, 10, 100, 50); SolidBrush brush = new SolidBrush(Color.Blue); graphics.FillRectangle(brush, rect);
Rectangle rect = new Rectangle(50, 50, 75, 75); LinearGradientBrush brush = new LinearGradientBrush(rect, Color.Red, Color.Yellow, LinearGradientMode.Horizontal); graphics.FillRectangle(brush, rect);This code creates another rectangle object and a new linear gradient brush with a red and yellow gradient. It then fills the rectangle with this brush using the FillRectangle method of the graphics object. This method is a part of the .NET Framework class library.