FontMenuForm 基类见:http://blog.csdn.net/u013384702/article/details/17884617
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace CsStudy
{
class Bricks : FontMenuForm
{
public new static void Main()
{
Application.Run(new Bricks());
}
public Bricks()
{
Text = "Bricks";
strText = "Bricks";
font = new Font("Times New Roman", 144);
}
protected override void DoPage(System.Drawing.Graphics grph, System.Drawing.Color clr, int cx, int cy)
{
SizeF sizef = grph.MeasureString(strText, font);
Brush hbrush = new HatchBrush(HatchStyle.HorizontalBrick, Color.White, Color.Black);//阴影画刷
grph.DrawString(strText, font, hbrush, (cx - sizef.Width) / 2, (cy - sizef.Height) / 2);
}
}
}
效果图: