C # usage of Brush
From: http://m.cnblogs.com/66756/1675787.html? Full = 1
private void form1_paint (Object sender, painteventargs e)
{< br> // (solid brush)
rectangle myrect1 = new rectangle (20, 80,250,100 );
solidbrush mysbrush1 = new solidbrush (color. darkorchid);
solidbrush mysbrush2 = new solidbrush (color. aquamarine);
solidbrush mysbrush3 = new solidbrush (color. darkorange);
// (Gradient brush)
Lineargradientbrush mylbrush5 = new lineargradientbrush (rect1,
Color. darkorange, color. Aquamarine,
Lineargradientmode. backwarddiagonal );
// (Shadow brush)
Hatchbrush myhbrush5 = new hatchbrush (hatchstyle. diagonalcross,
Color. darkorange, color. Aquamarine );
Hatchbrush myhbrush2 = new hatchbrush (hatchstyle. darkvertical,
Color. darkorange, color. Aquamarine );
Hatchbrush myhbrush3 = new hatchbrush (hatchstyle. largeconfetti,
Color. darkorange, color. Aquamarine );
// (texture brush)
texturebrush = new texturebrush (New Bitmap (@ "E: \ 123.jpg");
E. graphics. fillrectangle (mysbrush1, rect1); // (solid fl)
E. graphics. fillrectangle (mylbrush1, rect1); // (gradient brush)
E. Graphics. fillrectangle (myhbrush1, rect1); // (shadow brush)
E. Graphics. fillrectangle (mytexturebrush, rect1); // (texture brush)
}
The namespace of the lineargradientbrush class is system. Drawing. drawing2d.