1, 使用drawImage的例子:
private void DrawImage(Graphics g)
{
if (backImg == null)
return;
else
this.Size = backImg.Size;
Rectangle r = new Rectangle(0,0, this.Size.Width, this.Size.Height);
g.DrawImage(backImg, r);
}
2, 使用TextureBrush的例子:
using (Image image = Image.FromFile(@"e:\pic.jpg"))
{
using (TextureBrush brush = new TextureBrush(image))
{
brush.TranslateTransform(x, y);
g.FillRectangle(brush, x, y, image.Width, image.Height);
g.Restore(state);
}
}
简单区别参考: http://www.cnblogs.com/xingd/archive/2005/02/02/101047.html