C#brush的使用

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

 

 

转载于:https://www.cnblogs.com/rentiansheng/archive/2010/03/01/1675787.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值