2

I used a canvas to render some long contents( for example texts, images, shapes, etc., of few pages) in WPF. When I scale it using Scale transform, it scales and the memory usage was under control. Now, I have an idea of using few image control in the canvas and rendered the above contents. But, when I scale up it as of same , memory gets increased to a large amount and when i scale down, the memory decreases. What could be the problem.

Code I used:

Image imagecntrl = new Image();
RenderTargetBitmap bitmap = new RenderTargetBitmap((int)(controlSize.Width * m_zoomFactor), (int)(controlSize.Height * m_zoomFactor), 96, 96, PixelFormats.Pbgra32);
bitmap.Render(pageVisual); //pageVisual is the DrawingVisual which contains the contents i mentioned earliar.
imagecntrl.Source = bitmap;
return imagecntrl;
Simon Sarris
  • 62,212
  • 13
  • 141
  • 171
Uthistran Selvaraj.
  • 558
  • 2
  • 11
  • 29
  • How often do you call that code? – Clemens Jul 29 '13 at 13:44
  • If it is only for displaying the rendered content of `pageVisual` you may have to read up on how to [Use DrawingVisual Objects](http://msdn.microsoft.com/en-us/library/ms742254.aspx) – Clemens Jul 29 '13 at 13:47

0 Answers0