Overlapping Hatch Brushes : Hatch Brush « 2D Graphics « C# / C Sharp






Overlapping Hatch Brushes

 
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
   
class OverlappingHatchBrushes: Form
{
     public static void Main()
     {
          Application.Run(new OverlappingHatchBrushes());
     }
     public OverlappingHatchBrushes()
     {
          ResizeRedraw = true; 
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
     }      
     protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
     {
          HatchBrush hbrush = new HatchBrush(HatchStyle.HorizontalBrick, 
                                             Color.White);
          for (int i = 0; i < 10; i++)
               grfx.FillRectangle(hbrush, i * cx / 10, i * cy / 10, 
                                          cx / 8, cy / 8);
     }
}

 








Related examples in the same category

1.Hatch Brush Rendering Origin
2.HatchBrush: HatchStyle PlaidHatchBrush: HatchStyle Plaid
3.HatchBrush: HatchStyle LargeCheckerBoardHatchBrush: HatchStyle LargeCheckerBoard
4.HatchBrush: HatchStyle DashedHorizontalHatchBrush: HatchStyle DashedHorizontal
5.HatchBrush: HatchStyle ZigZagHatchBrush: HatchStyle ZigZag
6.Use HatchBrush to draw StringUse HatchBrush to draw String
7.Hatch Brush: crossHatch Brush: cross
8.Hatch Brush Style: WideUpwardDiagonalHatch Brush Style: WideUpwardDiagonal
9.List all Hatch Brush stylesList all Hatch Brush styles