Hatch Brush Rendering Origin : Hatch Brush : Graphics C# Source Code


Custom Search

C# Source Code » Graphics » Hatch Brush »

 

Hatch Brush Rendering Origin








    
 
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
   
class HatchBrushRenderingOrigin: Form
{
     public static void Main()
     {
          Application.Run(new HatchBrushRenderingOrigin());
     }
     public HatchBrushRenderingOrigin()
     {
          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.RenderingOrigin = new Point(i * cx / 10, i * cy / 10);
   
               grfx.FillRectangle(hbrush, i * cx / 10, i * cy / 10, 
                                          cx / 8, cy / 8);
          }
     }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Graphics
» Hatch Brush