Tag Archives: using statement

Use the using statement to automatically call Dispose in C#

The using statement makes it easier to free resources when you’re finished with an object. Some objects take up important resources (such as brush handles or file handles) and only free them when they are destroyed. Because of the weird … Continue reading

Posted in OOP, syntax | Tagged , , , , , , , , , , , | Leave a 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