private void Form1_Paint(object sender, PaintEventArgs e)
{
Brush foreBrush = Brushes.Blue;
Font font = new Font("幼圆", Convert.ToInt16(40), FontStyle.Regular);
Graphics g = this.CreateGraphics();
string text = "博客园";
SizeF size = g.MeasureString(text, font);
Single posX = (this.Width - Convert.ToInt16(size.Width)) / 2;
Single posY = (this.Height - Convert.ToInt16(size.Height)) / 2;
g.TranslateTransform(posX, posY);
Matrix transform = g.Transform;
//右倾斜文字
//float shearX = -0.230F;
//左倾斜文字
float shearX = 0.550F;
float shearY = 0.10F;
transform.Shear(shearX, shearY);
g.Transform = transform;
g.DrawString(text, font, foreBrush, 0, 0);
}
{
Brush foreBrush = Brushes.Blue;
Font font = new Font("幼圆", Convert.ToInt16(40), FontStyle.Regular);
Graphics g = this.CreateGraphics();
string text = "博客园";
SizeF size = g.MeasureString(text, font);
Single posX = (this.Width - Convert.ToInt16(size.Width)) / 2;
Single posY = (this.Height - Convert.ToInt16(size.Height)) / 2;
g.TranslateTransform(posX, posY);
Matrix transform = g.Transform;
//右倾斜文字
//float shearX = -0.230F;
//左倾斜文字
float shearX = 0.550F;
float shearY = 0.10F;
transform.Shear(shearX, shearY);
g.Transform = transform;
g.DrawString(text, font, foreBrush, 0, 0);
}