2

我使用画布在 WPF 中呈现一些较长的内容(例如,几页的文本、图像、形状等)。当我使用 Scale 变换对其进行缩放时,它会缩放并且内存使用情况得到控制。现在,我有了在画布中使用少量图像控件并渲染上述内容的想法。但是,当我扩大规模时,内存会增加很多,而当我缩小规模时,内存会减少。可能是什么问题呢。

我使用的代码:

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;
4

0 回答 0