Mega Code Archive

 
Categories / C# / 2D Graphics
 

Draw string with hatch brush

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Text; using System.Windows.Forms; public class Form1 : Form {     protected override void OnPaint(PaintEventArgs e) {     Graphics g = e.Graphics;     g.FillRectangle(Brushes.White, this.ClientRectangle);     Font f = new Font("Times New Roman", 48, FontStyle.Bold);     HatchBrush hb = new HatchBrush(HatchStyle.Cross,Color.White, Color.Black);     g.DrawString("Crazy Crosshatch", f, hb, 0, 0);     f.Dispose();     }     public static void Main() {         Application.Run(new Form1());     } }