我在WindowsPhone应用程序中使用WriteableBitmap将UIElement转换为WriteableBitmap。我在以下代码中随机获取Value不在预期范围内的异常。但我无法找到根本原因。你能帮助我吗?
Size imageSize = new Size(element.ActualWidth, element.ActualHeight);
WriteableBitmap image = new WriteableBitmap((int)imageSize.Width, (int)imageSize.Height);
image.Render(element, null);
image.Invalidate();
return image;
答案 0 :(得分:0)
试试这个:
WriteableBitmap image = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
image.Render(element, new MatrixTransform());
image.Invalidate();
return image;