这应该足以让你入门:
private void ExportCanvas(int width, int height) { string path = @"c:\temp\Test.tif"; FileStream fs = new FileStream(path, FileMode.Create); RenderTargetBitmap renderBitmap = new RenderTargetBitmap(width, height, 1/300, 1/300, PixelFormats.Pbgra32); DrawingVisual visual = new DrawingVisual(); using (DrawingContext context = visual.RenderOpen()) { VisualBrush brush = new VisualBrush(MyCanvas); context.DrawRectangle(brush, null, new Rect(new Point(), new Size(MyCanvas.Width, MyCanvas.Height))); } visual.Transform = new ScaleTransform(width / MyCanvas.ActualWidth, height / MyCanvas.ActualHeight); renderBitmap.Render(visual); BitmapEncoder encoder = new TiffBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(renderBitmap)); encoder.Save(fs); fs.Close(); }