C#brush的使用
C#brush的使用
from:http://m.cnblogs.com/66756/1675787.html?full=1
private void Form1_Paint(object sender, PaintEventArgs e)
{
// (实心刷)
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);
//(梯度刷)
LinearGradientBrush mylbrush5 = new LinearGradientBrush(rect1,
Color.DarkOrange, Color.Aquamarine,
LinearGradientMode.BackwardDiagonal);
//(阴影刷)
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);
//(纹理刷)
TextureBrush textureBrush = new TextureBrush(new Bitmap(@"e:\123.jpg"));
e.Graphics.FillRectangle(mysbrush1, rect1); // (实心刷)
e.Graphics.FillRectangle(mylbrush1, rect1); //(梯度刷)
e.Graphics.FillRectangle(myhbrush1, rect1); //(阴影刷)
e.Graphics.FillRectangle(mytextureBrush, rect1); //(纹理刷)
}
LinearGradientBrush 类的命名空间为 System.Drawing.Drawing2D