本帖最后由 porenasckx 于 2013-12-26 18:14:43 编辑

解决方案 »

  1.   

    http://blog.csdn.net/xuexiaodong009/article/details/6935440
      

  2.   

    用http://blog.csdn.net/xuexiaodong009/article/details/6935440
    提供的方法:
      private FormattedText DrawText(string s)
            {
                FormattedText text = new FormattedText(s,
                        new CultureInfo("en-us"),
                        FlowDirection.LeftToRight,
                        new Typeface(new FontFamily(), FontStyles.Normal,
                            FontWeights.Normal, new FontStretch()),
                        20, SystemColors.GrayTextBrush);
                return text;        }
            private RenderTargetBitmap DrawBitmap()
            {
                            DrawingVisual drawingVisual = new DrawingVisual();
                DrawingContext drawingContext = drawingVisual.RenderOpen();
                DrawReport(drawingContext, "1 6", 115, 30);
                DrawReport(drawingContext, "2 7", 115, 50);
                DrawReport(drawingContext, "3 8", 115, 70);
                DrawReport(drawingContext, "4 9", 115, 90);
                DrawReport(drawingContext, "5 10",115, 110);           
                drawingContext.Close();
                RenderTargetBitmap bmp = new RenderTargetBitmap(240, 500,
                    96, 96, PixelFormats.Pbgra32);
                bmp.Render(drawingVisual);
                return bmp;
            }        private void DrawReport(DrawingContext dc, string s, int x, int y)
            {
                dc.DrawText(DrawText(s), new Point(x, y));
            }        private void button1_Click(object sender, RoutedEventArgs e)
            {
                 Image theImage = new Image();           
                 theImage.Source = DrawBitmap();
                 dockPanel1.Children.Add(theImage);                    }