浮雕文字实现


private void Form1_Paint(object sender, PaintEventArgs e)
{
//浮雕文字
Brush backBrush = Brushes.Black;
Brush foreBrush 
= Brushes.White;
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.DrawString(text, font, backBrush, posX
+1, posY+1);
g.DrawString(text, font, foreBrush, posX, posY);
}

你可能感兴趣的:(实现)