12
BitmapImage bitmapImage = new BitmapImage(new Uri("arka_projects_as_logo.png", UriKind.Relative));
Image uiElement = new Image() { Source = bitmapImage };
ScaleTransform t = new ScaleTransform() { ScaleX = 0.2, ScaleY = 0.2 };
WriteableBitmap writeableBitmap = new WriteableBitmap(uiElement,t);

我想将此转换的结果(writeableBitmap)插入到 System.Windows.Controls.Image 中。当我这样做时:

Image arkaImage = new Image() { Source = writeableBitmap };

arkaImage根本没有显示。可以做些什么来让它发挥作用?

4

2 回答 2

10
WriteableBitmap wb = ..
using (MemoryStream ms = new MemoryStream())
{
    wb.SaveJpeg(ms, (int)image1.Width, (int)image1.Height, 0, 100);
    BitmapImage bmp = new BitmapImage();
    bmp.SetSource(ms);
}
于 2010-10-21T11:04:49.040 回答
2

你为什么不把 也应用ScaleTransformUIElement

于 2010-10-21T10:58:18.383 回答