Tag Archives: brush

Draw text with a moving brush in C#

This example uses a technique similar to the one used by the example Make a moving background in C#. It uses a gradient brush to draw its text. When the program’s Timer fires, its Tick event handler refreshes the PictureBox … Continue reading

Posted in drawing, fonts, graphics | Tagged , , , , , , , , , , , | Leave a comment

Draw an ellipse that sort of looks like a button in C#

This example uses two LinearGradientBrushes to draw an ellipse that has a sort of three-dimensional button-like appearance. The key is to outline the ellipse and then fill it with brushes whose gradients point in opposite directions. The following code shows … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , | Leave a comment

Let the user move the center point of an elliptical gradient in C#

The example Fill an area with an elliptical gradient in C# shows how to make a brush that fills an area with an elliptical gradient. This example just lets the user move the gradient’s center point. When you move the … Continue reading

Posted in graphics | Tagged , , , , , , , , , , , , , | Leave a comment

Fill an area with an elliptical gradient in C#

Filling an area with an elliptical gradient is non-trivial in a Windows Forms application because the .NET Framework libraries intended for use with Windows Forms don’t include a RadialGradientBrush class. There is such a class in the System.Windows.Media namespace, but … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , , , | 1 Comment

Fill a polygon with a PathGradientBrush in C#

A PathGradientBrush defines a brush that shades smoothly from a “center point” to specific points along a path. This example fills a hexagon with colors that shade from white in the center to red, yellow, lime, cyan, blue, and magenta … Continue reading

Posted in graphics | Tagged , , , , , , , , , , , , , | 2 Comments

Use a LinearGradientBrush in C#

A LinearGradientBrush fills an area with a color gradient that blends smoothly from one color to another. The LinearGradientBrush class has a Dispose method that you should call when you’re done with the brush. To make that easier, place the … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , | 2 Comments