Draw string with hatch brush : Text Rendering « 2D Graphics « C# / C Sharp






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());
    }
}

 








Related examples in the same category

1.Hotkey Prefix
2.Use TexturedBrush to draw stringUse TexturedBrush to draw string
3.Text Rendering Hint: SingleBitPerPixelGridFitText Rendering Hint: SingleBitPerPixelGridFit
4.Text Rendering Hint: AntiAliasGridFitText Rendering Hint: AntiAliasGridFit
5.Text Rendering Hint: ClearTypeGridFitText Rendering Hint: ClearTypeGridFit
6.TextRenderingHint: Anti-Aliased Text
7.DrawString with solid brush, string format
8.DrawString with solid brush and rectangle