C#制作艺术字2011-04-17相信word中的艺术字功能大家都不陌生,前面这个"Word"单词就是它所为.今天,我们就利用C#来制作几款自己的艺术字,可能会对我们了解字体图像的制作原理有一些帮助.至于有没有使用价值我保持沉默.一.投影效果程序运行效果截图:

程序代码实现如下:投影效果代码
private void Form1_Paint(object sender, PaintEventArgs e)
{
//投影文字
Graphics g = this.CreateGraphics();
//设置文本输出质量
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
g.SmoothingMode = SmoothingMode.AntiAlias;
Font newFont = new Font("Times New Roman", 48);
Matrix matrix = new Matrix();
//投射
matrix.Shear(-1.5f, 0.0f);
//缩放
matrix.Scale(1, 0.5f);
//平移
matrix.Translate(130, 88);
//对绘图平面实施坐标变换、、
g.Transform = matrix;
SolidBrush grayBrush = new SolidBrush(Color.Gray);
SolidBrush colorBrush = new SolidBrush(Color.BlueViolet);
string text = "博客园";
//绘制阴影
g.DrawString(text, newFont, grayBrush, new PointF(0, 30));
g.ResetTransform();
//绘制前景
g.DrawString(text, newFont, colorBrush, new PointF(0, 30));
}