二.浮雕效果
程序運行效果截圖:
程序代碼實現如下:
浮雕文字實現
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);
}
三. 印版效果
程序運行效果截圖:
程序代碼實現如下:
印版文字實現
private void Form1_Paint(object sender, PaintEventArgs e)
{
//印版文字
int i = 0;
Brush backBrush = Brushes.Black;
Brush foreBrush = Brushes.Violet;
Font font = new Font("Times New Roman", System.Convert.ToInt16(40), FontStyle.Regular);
Graphics g = this.CreateGraphics();
g.Clear(Color.White);
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)) / 3;
while (i < Convert.ToInt16(20))
{
g.DrawString(text, font, backBrush, posX - i, posY + i);
i = i + 1;
}
g.DrawString(text, font, foreBrush, posX, posY);
}